Example usage for java.lang Integer TYPE

List of usage examples for java.lang Integer TYPE

Introduction

In this page you can find the example usage for java.lang Integer TYPE.

Prototype

Class TYPE

To view the source code for java.lang Integer TYPE.

Click Source Link

Document

The Class instance representing the primitive type int .

Usage

From source file:com.opengamma.language.definition.JavaTypeInfo.java

private static Class<?> findClass(final String className) throws ClassNotFoundException {
    if ("boolean".equals(className)) {
        return Boolean.TYPE;
    } else if ("char".equals(className)) {
        return Character.TYPE;
    } else if ("double".equals(className)) {
        return Double.TYPE;
    } else if ("float".equals(className)) {
        return Float.TYPE;
    } else if ("int".equals(className)) {
        return Integer.TYPE;
    } else if ("long".equals(className)) {
        return Long.TYPE;
    } else if ("short".equals(className)) {
        return Short.TYPE;
    } else {//from   w ww .j  a  va2s  .co m
        return Class.forName(className);
    }
}

From source file:com.mawujun.util.AnnotationUtils.java

/**
 * Helper method for comparing two objects of an array type.
 *
 * @param componentType the component type of the array
 * @param o1 the first object//from ww w  . j a v  a  2s . c om
 * @param o2 the second object
 * @return a flag whether these objects are equal
 */
private static boolean arrayMemberEquals(Class<?> componentType, Object o1, Object o2) {
    if (componentType.isAnnotation()) {
        return annotationArrayMemberEquals((Annotation[]) o1, (Annotation[]) o2);
    }
    if (componentType.equals(Byte.TYPE)) {
        return Arrays.equals((byte[]) o1, (byte[]) o2);
    }
    if (componentType.equals(Short.TYPE)) {
        return Arrays.equals((short[]) o1, (short[]) o2);
    }
    if (componentType.equals(Integer.TYPE)) {
        return Arrays.equals((int[]) o1, (int[]) o2);
    }
    if (componentType.equals(Character.TYPE)) {
        return Arrays.equals((char[]) o1, (char[]) o2);
    }
    if (componentType.equals(Long.TYPE)) {
        return Arrays.equals((long[]) o1, (long[]) o2);
    }
    if (componentType.equals(Float.TYPE)) {
        return Arrays.equals((float[]) o1, (float[]) o2);
    }
    if (componentType.equals(Double.TYPE)) {
        return Arrays.equals((double[]) o1, (double[]) o2);
    }
    if (componentType.equals(Boolean.TYPE)) {
        return Arrays.equals((boolean[]) o1, (boolean[]) o2);
    }
    return Arrays.equals((Object[]) o1, (Object[]) o2);
}

From source file:com.xwtec.xwserver.util.json.util.JSONUtils.java

/**
 * Tests if Class represents a primitive number or wrapper.<br>
 *//*  ww  w. j  ava  2 s .c o  m*/
public static boolean isNumber(Class clazz) {
    return clazz != null && (Byte.TYPE.isAssignableFrom(clazz) || Short.TYPE.isAssignableFrom(clazz)
            || Integer.TYPE.isAssignableFrom(clazz) || Long.TYPE.isAssignableFrom(clazz)
            || Float.TYPE.isAssignableFrom(clazz) || Double.TYPE.isAssignableFrom(clazz)
            || Number.class.isAssignableFrom(clazz));
}

From source file:net.sourceforge.pmd.typeresolution.ClassTypeResolverTest.java

@Test
public void testLiterals() throws JaxenException {
    ASTCompilationUnit acu = parseAndTypeResolveForClass15(Literals.class);
    List<ASTLiteral> literals = convertList(acu.findChildNodesWithXPath("//Literal"), ASTLiteral.class);
    int index = 0;

    // String s = "s";
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(String.class, literals.get(index++).getType());

    // boolean boolean1 = false;
    assertEquals(Boolean.TYPE, literals.get(index).getFirstDescendantOfType(ASTBooleanLiteral.class).getType());
    assertEquals(Boolean.TYPE, literals.get(index++).getType());

    // boolean boolean2 = true;
    assertEquals(Boolean.TYPE, literals.get(index).getFirstDescendantOfType(ASTBooleanLiteral.class).getType());
    assertEquals(Boolean.TYPE, literals.get(index++).getType());

    // Object obj = null;
    assertNull(literals.get(index).getFirstDescendantOfType(ASTNullLiteral.class).getType());
    assertNull(literals.get(index++).getType());

    // byte byte1 = 0;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Integer.TYPE, literals.get(index++).getType());

    // byte byte2 = 0x0F;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Integer.TYPE, literals.get(index++).getType());

    // byte byte3 = -007;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Integer.TYPE, literals.get(index++).getType());

    // short short1 = 0;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Integer.TYPE, literals.get(index++).getType());

    // short short2 = 0x0F;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Integer.TYPE, literals.get(index++).getType());

    // short short3 = -007;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Integer.TYPE, literals.get(index++).getType());

    // char char1 = 0;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Integer.TYPE, literals.get(index++).getType());

    // char char2 = 0x0F;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Integer.TYPE, literals.get(index++).getType());

    // char char3 = 007;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Integer.TYPE, literals.get(index++).getType());

    // char char4 = 'a';
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Character.TYPE, literals.get(index++).getType());

    // int int1 = 0;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Integer.TYPE, literals.get(index++).getType());

    // int int2 = 0x0F;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Integer.TYPE, literals.get(index++).getType());

    // int int3 = -007;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Integer.TYPE, literals.get(index++).getType());

    // int int4 = 'a';
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Character.TYPE, literals.get(index++).getType());

    // long long1 = 0;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Integer.TYPE, literals.get(index++).getType());

    // long long2 = 0x0F;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Integer.TYPE, literals.get(index++).getType());

    // long long3 = -007;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Integer.TYPE, literals.get(index++).getType());

    // long long4 = 0L;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Long.TYPE, literals.get(index++).getType());

    // long long5 = 0x0Fl;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Long.TYPE, literals.get(index++).getType());

    // long long6 = -007L;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Long.TYPE, literals.get(index++).getType());

    // long long7 = 'a';
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Character.TYPE, literals.get(index++).getType());

    // float float1 = 0.0f;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Float.TYPE, literals.get(index++).getType());

    // float float2 = -10e+01f;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Float.TYPE, literals.get(index++).getType());

    // float float3 = 0x08.08p3f;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Float.TYPE, literals.get(index++).getType());

    // float float4 = 0xFF;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Integer.TYPE, literals.get(index++).getType());

    // float float5 = 'a';
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Character.TYPE, literals.get(index++).getType());

    // double double1 = 0.0;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Double.TYPE, literals.get(index++).getType());

    // double double2 = -10e+01;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Double.TYPE, literals.get(index++).getType());

    // double double3 = 0x08.08p3;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Double.TYPE, literals.get(index++).getType());

    // double double4 = 0xFF;
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Integer.TYPE, literals.get(index++).getType());

    // double double5 = 'a';
    assertEquals(0, literals.get(index).jjtGetNumChildren());
    assertEquals(Character.TYPE, literals.get(index++).getType());

    // Make sure we got them all.
    assertEquals("All literals not tested", index, literals.size());
}

From source file:net.sf.json.JSONDynaBean.java

/**
 * DOCUMENT ME!/* ww w.jav a2 s .c  o  m*/
 *
 * @param dest DOCUMENT ME!
 * @param src DOCUMENT ME!
 *
 * @return DOCUMENT ME!
 */
protected boolean isDynaAssignable(Class dest, Class src) {
    boolean assignable = dest.isAssignableFrom(src);
    assignable = ((dest == Boolean.TYPE) && (src == Boolean.class)) ? true : assignable;
    assignable = ((dest == Byte.TYPE) && (src == Byte.class)) ? true : assignable;
    assignable = ((dest == Character.TYPE) && (src == Character.class)) ? true : assignable;
    assignable = ((dest == Short.TYPE) && (src == Short.class)) ? true : assignable;
    assignable = ((dest == Integer.TYPE) && (src == Integer.class)) ? true : assignable;
    assignable = ((dest == Long.TYPE) && (src == Long.class)) ? true : assignable;
    assignable = ((dest == Float.TYPE) && (src == Float.class)) ? true : assignable;
    assignable = ((dest == Double.TYPE) && (src == Double.class)) ? true : assignable;

    if ((src == Double.TYPE) || Double.class.isAssignableFrom(src)) {
        assignable = (isByte(dest) || isShort(dest) || isInteger(dest) || isLong(dest) || isFloat(dest)) ? true
                : assignable;
    }

    if ((src == Float.TYPE) || Float.class.isAssignableFrom(src)) {
        assignable = (isByte(dest) || isShort(dest) || isInteger(dest) || isLong(dest)) ? true : assignable;
    }

    if ((src == Long.TYPE) || Long.class.isAssignableFrom(src)) {
        assignable = (isByte(dest) || isShort(dest) || isInteger(dest)) ? true : assignable;
    }

    if ((src == Integer.TYPE) || Integer.class.isAssignableFrom(src)) {
        assignable = (isByte(dest) || isShort(dest)) ? true : assignable;
    }

    if ((src == Short.TYPE) || Short.class.isAssignableFrom(src)) {
        assignable = (isByte(dest)) ? true : assignable;
    }

    return assignable;
}

From source file:org.fhcrc.cpl.toolbox.filehandler.TabLoader.java

/**
 * Look at first 5 lines of the file and infer col names, data types.
 * Most useful if maps are being returned, otherwise use inferColumnInfo(reader, clazz) to
 * use properties of a bean instead.//  w w w  .jav  a2s  .c o m
 *
 * @param reader
 * @throws IOException
 */
private void inferColumnInfo(BufferedReader reader) throws IOException {
    reader.mark(4096 * _scanAheadLineCount);

    String[] lines = new String[_scanAheadLineCount + Math.max(_skipLines, 0)];
    int i;
    for (i = 0; i < lines.length;) {
        String line = reader.readLine();
        if (null == line)
            break;
        if (line.length() == 0 || line.charAt(0) == '#')
            continue;
        lines[i++] = line;
    }
    int nLines = i;
    reader.reset();
    if (nLines == 0) {
        _columns = new ColumnDescriptor[0];
        return;
    }

    int nCols = 0;
    String[][] lineFields = new String[nLines][];
    for (i = 0; i < nLines; i++) {
        lineFields[i] = parseLine(lines[i]);
        nCols = Math.max(nCols, lineFields[i].length);
    }

    ColumnDescriptor[] colDescs = new ColumnDescriptor[nCols];
    for (i = 0; i < nCols; i++)
        colDescs[i] = new ColumnDescriptor();

    //Try to infer types
    int inferStartLine = _skipLines == -1 ? 1 : _skipLines;
    for (int f = 0; f < nCols; f++) {
        int classIndex = -1;
        for (int line = inferStartLine; line < nLines; line++) {
            if (f >= lineFields[line].length)
                continue;
            String field = lineFields[line][f];
            if ("".equals(field))
                continue;

            for (int c = Math.max(classIndex, 0); c < convertClasses.length; c++) {
                //noinspection EmptyCatchBlock
                try {
                    Object o = ConvertUtils.convert(field, convertClasses[c]);
                    //We found a type that works. If it is more general than
                    //what we had before, we must use it.
                    if (o != null && c > classIndex)
                        classIndex = c;
                    break;
                } catch (Exception x) {
                }
            }
        }
        colDescs[f].clazz = classIndex == -1 ? String.class : convertClasses[classIndex];
    }

    //If first line is compatible type for all fields, AND all fields not Strings (dhmay adding 20100502)
    // then there is no header row
    if (_skipLines == -1) {
        boolean firstLineCompat = true;
        boolean allStrings = true;
        String[] fields = lineFields[0];
        for (int f = 0; f < nCols; f++) {
            if ("".equals(fields[f]))
                continue;
            if (colDescs[f].clazz.equals(Integer.TYPE) || colDescs[f].clazz.equals(Double.TYPE)
                    || colDescs[f].clazz.equals(Float.TYPE))
                allStrings = false;
            try {
                Object o = ConvertUtils.convert(fields[f], colDescs[f].clazz);
                if (null == o) {
                    firstLineCompat = false;
                    break;
                }
            } catch (Exception x) {
                firstLineCompat = false;
                break;
            }
        }
        if (firstLineCompat && !allStrings)
            _skipLines = 0;
        else
            _skipLines = 1;
    }

    if (_skipLines > 0) {
        String[] headers = lineFields[_skipLines - 1];
        for (int f = 0; f < nCols; f++)
            colDescs[f].name = (f >= headers.length || "".equals(headers[f])) ? "column" + f : headers[f];
    } else {
        for (int f = 0; f < colDescs.length; f++) {
            ColumnDescriptor colDesc = colDescs[f];
            colDesc.name = "column" + f;
        }
    }

    _columns = colDescs;
}

From source file:com.joemelsha.crypto.hash.KeccakTest.java

private T create() {
    try {/*from ww w.  ja va  2s  . c o  m*/
        return type.getConstructor(Integer.TYPE).newInstance(digestSizeBits);
    } catch (InstantiationException x) {
        throw new RuntimeException(x);
    } catch (IllegalAccessException x) {
        throw new RuntimeException(x);
    } catch (IllegalArgumentException x) {
        throw new RuntimeException(x);
    } catch (InvocationTargetException x) {
        throw new RuntimeException(x);
    } catch (NoSuchMethodException x) {
        throw new RuntimeException(x);
    } catch (SecurityException x) {
        throw new RuntimeException(x);
    }
}

From source file:net.sf.qooxdoo.rpc.RemoteCallUtils.java

/**
 * Converts "normal" java types to JSON stuff.
 *
 * @param       obj                 the object to convert.
 *//*from ww  w .  j  a va 2s . c o m*/

public Object fromJava(Object obj)
        throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
    if (obj == null) {
        return JSONObject.NULL;
    }
    if (obj instanceof String) {
        return obj;
    }
    if (obj instanceof Date) {
        return obj;
    }
    if (obj instanceof Integer || obj instanceof Double || obj instanceof Boolean) {
        return obj;
    }
    if (obj instanceof Float) {
        return new Double(((Float) obj).doubleValue());
    }
    // FIXME: find a better way to handle longs
    if (obj instanceof Long) {
        return new Double(((Long) obj).doubleValue());
    }
    if (obj instanceof Object[]) {
        Object[] objectArray = (Object[]) obj;
        JSONArray jsonArray = new JSONArray();
        for (int i = 0; i < objectArray.length; ++i) {
            jsonArray.put(fromJava(objectArray[i]));
        }
        return jsonArray;
    }
    Class componentType = obj.getClass().getComponentType();
    if (componentType == Integer.TYPE) {
        JSONArray jsonArray = new JSONArray();
        int[] intArray = (int[]) obj;
        for (int i = 0; i < intArray.length; ++i) {
            jsonArray.put(intArray[i]);
        }
        return jsonArray;
    }
    if (componentType == Float.TYPE) {
        JSONArray jsonArray = new JSONArray();
        float[] floatArray = (float[]) obj;
        for (int i = 0; i < floatArray.length; ++i) {
            jsonArray.put((double) (floatArray[i]));
        }
        return jsonArray;
    }
    // FIXME: find a better way to handle longs
    if (componentType == Long.TYPE) {
        JSONArray jsonArray = new JSONArray();
        long[] longArray = (long[]) obj;
        for (int i = 0; i < longArray.length; ++i) {
            jsonArray.put((double) (longArray[i]));
        }
        return jsonArray;
    }
    if (componentType == Double.TYPE) {
        JSONArray jsonArray = new JSONArray();
        double[] doubleArray = (double[]) obj;
        for (int i = 0; i < doubleArray.length; ++i) {
            jsonArray.put(doubleArray[i]);
        }
        return jsonArray;
    }
    if (componentType == Boolean.TYPE) {
        JSONArray jsonArray = new JSONArray();
        boolean[] booleanArray = (boolean[]) obj;
        for (int i = 0; i < booleanArray.length; ++i) {
            jsonArray.put(booleanArray[i]);
        }
        return jsonArray;
    }
    if (obj instanceof Map) {
        Map map = (Map) obj;
        Iterator keyIterator = map.keySet().iterator();
        JSONObject jsonObject = new JSONObject();
        Object key;
        while (keyIterator.hasNext()) {
            key = keyIterator.next();
            jsonObject.put((key == null ? null : key.toString()), fromJava(map.get(key)));
        }
        return jsonObject;
    }
    if (obj instanceof Set) {
        Set set = (Set) obj;
        Iterator iterator = set.iterator();
        JSONObject jsonObject = new JSONObject();
        Object key;
        while (iterator.hasNext()) {
            key = iterator.next();
            jsonObject.put((key == null ? null : key.toString()), true);
        }
        return jsonObject;
    }
    return fromJava(filter(obj, PropertyUtils.describe(obj)));
}

From source file:com.icesoft.faces.renderkit.dom_html_basic.MenuRenderer.java

protected Object convertArray(FacesContext facesContext, UISelectMany uiSelectMany, Class componentType,
        String[] newSubmittedValues) throws ConverterException {

    // component type of String means no conversion is necessary
    if (componentType.equals(String.class)) {
        return newSubmittedValues;
    }//from w  w  w. ja v a  2 s .  c  om

    // if newSubmittedValue is null return zero-length array
    if (newSubmittedValues == null) {
        return Array.newInstance(componentType, 0);
    }

    // create the array with specified component length
    int numberOfValues = newSubmittedValues.length;
    Object convertedValues = Array.newInstance(componentType, numberOfValues);

    // Determine if a converter is explicitly registered with the component
    Converter converter = uiSelectMany.getConverter();
    if (converter == null) {
        // Determine if there is a default converter for the class
        converter = getConverterForClass(componentType);
    }
    if (converter == null) {
        // we don't need to convert base Object types
        if (componentType.equals(Object.class)) {
            return newSubmittedValues;
        } else {
            throw new ConverterException("Converter is null");
        }
    }

    for (int index = 0; index < numberOfValues; index++) {

        // convert the next element
        Object nextConvertedElement = converter.getAsObject(facesContext, uiSelectMany,
                newSubmittedValues[index]);

        if (!componentType.isPrimitive()) {
            Array.set(convertedValues, index, nextConvertedElement);
        } else if (componentType.equals(Boolean.TYPE)) {

            Array.setBoolean(convertedValues, index, ((Boolean) nextConvertedElement).booleanValue());

        } else if (componentType.equals(Integer.TYPE)) {

            Array.setInt(convertedValues, index, ((Integer) nextConvertedElement).intValue());

        } else if (componentType.equals(Long.TYPE)) {

            Array.setLong(convertedValues, index, ((Long) nextConvertedElement).longValue());

        } else if (componentType.equals(Short.TYPE)) {

            Array.setShort(convertedValues, index, ((Short) nextConvertedElement).shortValue());

        } else if (componentType.equals(Byte.TYPE)) {

            Array.setByte(convertedValues, index, ((Byte) nextConvertedElement).byteValue());

        } else if (componentType.equals(Float.TYPE)) {

            Array.setFloat(convertedValues, index, ((Float) nextConvertedElement).floatValue());

        } else if (componentType.equals(Double.TYPE)) {

            Array.setDouble(convertedValues, index, ((Double) nextConvertedElement).doubleValue());

        } else if (componentType.equals(Character.TYPE)) {

            Array.setChar(convertedValues, index, ((Character) nextConvertedElement).charValue());

        }
    }
    return convertedValues;
}

From source file:info.guardianproject.netcipher.web.WebkitProxy.java

@TargetApi(19)
private static boolean setKitKatProxy(String appClass, Context appContext, String host, int port) {
    //Context appContext = webView.getContext().getApplicationContext();

    if (host != null) {
        System.setProperty("http.proxyHost", host);
        System.setProperty("http.proxyPort", port + "");
        System.setProperty("https.proxyHost", host);
        System.setProperty("https.proxyPort", port + "");
    }/*w  w w.j a  v a  2s.  c o m*/

    try {
        Class applictionCls = Class.forName(appClass);
        Field loadedApkField = applictionCls.getField("mLoadedApk");
        loadedApkField.setAccessible(true);
        Object loadedApk = loadedApkField.get(appContext);
        Class loadedApkCls = Class.forName("android.app.LoadedApk");
        Field receiversField = loadedApkCls.getDeclaredField("mReceivers");
        receiversField.setAccessible(true);
        ArrayMap receivers = (ArrayMap) receiversField.get(loadedApk);
        for (Object receiverMap : receivers.values()) {
            for (Object rec : ((ArrayMap) receiverMap).keySet()) {
                Class clazz = rec.getClass();
                if (clazz.getName().contains("ProxyChangeListener")) {
                    Method onReceiveMethod = clazz.getDeclaredMethod("onReceive", Context.class, Intent.class);
                    Intent intent = new Intent(Proxy.PROXY_CHANGE_ACTION);

                    if (host != null) {
                        /*********** optional, may be need in future *************/
                        final String CLASS_NAME = "android.net.ProxyProperties";
                        Class cls = Class.forName(CLASS_NAME);
                        Constructor constructor = cls.getConstructor(String.class, Integer.TYPE, String.class);
                        constructor.setAccessible(true);
                        Object proxyProperties = constructor.newInstance(host, port, null);
                        intent.putExtra("proxy", (Parcelable) proxyProperties);
                        /*********** optional, may be need in future *************/
                    }

                    onReceiveMethod.invoke(rec, appContext, intent);
                }
            }
        }
        return true;
    } catch (ClassNotFoundException e) {
        StringWriter sw = new StringWriter();
        e.printStackTrace(new PrintWriter(sw));
        String exceptionAsString = sw.toString();
        Log.v(TAG, e.getMessage());
        Log.v(TAG, exceptionAsString);
    } catch (NoSuchFieldException e) {
        StringWriter sw = new StringWriter();
        e.printStackTrace(new PrintWriter(sw));
        String exceptionAsString = sw.toString();
        Log.v(TAG, e.getMessage());
        Log.v(TAG, exceptionAsString);
    } catch (IllegalAccessException e) {
        StringWriter sw = new StringWriter();
        e.printStackTrace(new PrintWriter(sw));
        String exceptionAsString = sw.toString();
        Log.v(TAG, e.getMessage());
        Log.v(TAG, exceptionAsString);
    } catch (IllegalArgumentException e) {
        StringWriter sw = new StringWriter();
        e.printStackTrace(new PrintWriter(sw));
        String exceptionAsString = sw.toString();
        Log.v(TAG, e.getMessage());
        Log.v(TAG, exceptionAsString);
    } catch (NoSuchMethodException e) {
        StringWriter sw = new StringWriter();
        e.printStackTrace(new PrintWriter(sw));
        String exceptionAsString = sw.toString();
        Log.v(TAG, e.getMessage());
        Log.v(TAG, exceptionAsString);
    } catch (InvocationTargetException e) {
        StringWriter sw = new StringWriter();
        e.printStackTrace(new PrintWriter(sw));
        String exceptionAsString = sw.toString();
        Log.v(TAG, e.getMessage());
        Log.v(TAG, exceptionAsString);
    } catch (InstantiationException e) {
        StringWriter sw = new StringWriter();
        e.printStackTrace(new PrintWriter(sw));
        String exceptionAsString = sw.toString();
        Log.v(TAG, e.getMessage());
        Log.v(TAG, exceptionAsString);
    }
    return false;
}