Java Primitive Type Create toPrimitiveClass(Class wrapperClass)

Here you can find the source of toPrimitiveClass(Class wrapperClass)

Description

to Primitive Class

License

Apache License

Declaration

public static Class<?> toPrimitiveClass(Class<?> wrapperClass) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static Class<?> toPrimitiveClass(Class<?> wrapperClass) {
        if (wrapperClass == Integer.class) {
            return Integer.TYPE;
        } else if (wrapperClass == Byte.class) {
            return Byte.TYPE;
        } else if (wrapperClass == Short.class) {
            return Short.TYPE;
        } else if (wrapperClass == Long.class) {
            return Long.TYPE;
        } else if (wrapperClass == Float.class) {
            return Float.TYPE;
        } else if (wrapperClass == Double.class) {
            return Double.TYPE;
        } else if (wrapperClass == Character.class) {
            return Character.TYPE;
        } else if (wrapperClass == Boolean.class) {
            return Boolean.TYPE;
        } else {//from w  w w . j  ava 2 s.  c  o m
            return wrapperClass;
        }
    }
}

Related

  1. toPrimitiveArray(Object[] array)
  2. toPrimitiveArrayType(Class c)
  3. toPrimitiveBoolean(Object o)
  4. toPrimitiveBoolean(Object o)
  5. toPrimitiveByteArray(Integer[] array)
  6. toPrimitiveDouble(Double d)
  7. toPrimitiveInt(Integer value)
  8. toPrimitiveInt(Object o)
  9. toPrimitiveNumber(String s)