Java Primitive Type Create toPrimitive(Class aClass)

Here you can find the source of toPrimitive(Class aClass)

Description

Returns non primitive type for primitive.

License

Open Source License

Declaration

public static Class toPrimitive(Class aClass) 

Method Source Code

//package com.java2s;

public class Main {
    static Class _primitives[] = { boolean.class, char.class, byte.class, short.class, int.class, long.class,
            float.class, double.class, void.class };
    static Class _primMappings[] = { Boolean.class, Character.class, Byte.class, Short.class, Integer.class,
            Long.class, Float.class, Double.class, Void.class };

    /**/*ww w.j a  va2  s .  co m*/
     * Returns non primitive type for primitive.
     */
    public static Class toPrimitive(Class aClass) {
        for (int i = 0; i < _primitives.length; i++)
            if (aClass == _primMappings[i])
                return _primitives[i];
        return aClass;
    }
}

Related

  1. toPrimitive(Byte[] byteArray)
  2. toPrimitive(Byte[] bytes)
  3. toPrimitive(Byte[] objectArray)
  4. toPrimitive(Character value)
  5. toPrimitive(Character[] in)
  6. toPrimitive(Class clazz)
  7. toPrimitive(Double[] array)
  8. toPrimitive(Double[] array)
  9. toPrimitive(Double[] doubles)