Here you can find the source of convertPrimitiveToObjectClass(Class> clazz)
Parameter | Description |
---|---|
clazz | a parameter |
public static Class<?> convertPrimitiveToObjectClass(Class<?> clazz)
//package com.java2s; //License from project: Apache License import java.util.HashMap; import java.util.Map; public class Main { private static final Map<Class<?>, Class<?>> primitiveToObjectClassMap = new HashMap<Class<?>, Class<?>>(); /**/*from w ww .java 2s . co m*/ * The class equivalent of (manual) autoboxing. * * @param clazz * @return */ public static Class<?> convertPrimitiveToObjectClass(Class<?> clazz) { if (isPrimitiveClass(clazz)) { return primitiveToObjectClassMap.get(clazz); } return clazz; } /** * Determines whether the given clazz is a primitive class. * * @param clazz * @return */ public static boolean isPrimitiveClass(Class<?> clazz) { return primitiveToObjectClassMap.containsKey(clazz); } }