Java Primitive Type Create toPrimitiveType(Class type)

Here you can find the source of toPrimitiveType(Class type)

Description

to Primitive Type

License

Open Source License

Declaration

public static Class<?> toPrimitiveType(Class<?> type) 

Method Source Code

//package com.java2s;

public class Main {
    public static Class<?> toPrimitiveType(Class<?> type) {
        if (type == Boolean.class)
            return Boolean.TYPE;
        else if (type == Byte.class)
            return Byte.TYPE;
        else if (type == Short.class)
            return Short.TYPE;
        else if (type == Integer.class)
            return Integer.TYPE;
        else if (type == Long.class)
            return Long.TYPE;
        else if (type == Float.class)
            return Float.TYPE;
        else if (type == Double.class)
            return Double.TYPE;
        else//from  w ww. j a v a  2s . co  m
            return type;
    }
}

Related

  1. toPrimitiveInt(Integer value)
  2. toPrimitiveInt(Object o)
  3. toPrimitiveNumber(String s)
  4. toPrimitiveType(Class c)
  5. toPrimitiveType(Class cls)
  6. toPrimitiveWrapper(Class type)
  7. toPrimitiveWrapper(String primitiveJson, Class clazz)