Here you can find the source of isPrimitiveWrapper(Class> clazz)
Parameter | Description |
---|---|
clazz | the class to check |
public static boolean isPrimitiveWrapper(Class<?> clazz)
//package com.java2s; import java.util.HashMap; import java.util.Map; public class Main { /**//from www. ja v a 2 s .c om * Map with primitive wrapper type as key and corresponding primitive * type as value, for example: Integer.class -> int.class. */ private static final Map<Class<?>, Class<?>> primitiveWrapperTypeMap = new HashMap<Class<?>, Class<?>>(8); /** * Check if the given class represents a primitive wrapper, * i.e. Boolean, Byte, Character, Short, Integer, Long, Float, or Double. * @param clazz the class to check * @return whether the given class is a primitive wrapper class */ public static boolean isPrimitiveWrapper(Class<?> clazz) { if (clazz == null) { throw new IllegalArgumentException("Class must not be null"); } return primitiveWrapperTypeMap.containsKey(clazz); } }