📅  最后修改于: 2022-03-11 14:52:09.557000             🧑  作者: Mango
// safe because both Long.class and long.class are of type Class
@SuppressWarnings("unchecked")
private static Class wrap(Class c) {
return c.isPrimitive() ? (Class) PRIMITIVES_TO_WRAPPERS.get(c) : c;
}
private static final Map, Class>> PRIMITIVES_TO_WRAPPERS
= new ImmutableMap.Builder, Class>>()
.put(boolean.class, Boolean.class)
.put(byte.class, Byte.class)
.put(char.class, Character.class)
.put(double.class, Double.class)
.put(float.class, Float.class)
.put(int.class, Integer.class)
.put(long.class, Long.class)
.put(short.class, Short.class)
.put(void.class, Void.class)
.build();