Boxing { public static Maybe<String> getPrimitiveName(Class<?> type) { if (type!=null) { if (PRIMITIVE_TO_BOXED.containsKey(type)) return Maybe.of(type.getName()); if (PRIMITIVE_TO_BOXED.containsValue(type)) { return Maybe.of(PRIMITIVE_TO_BOXED.inverse().get(type).getName()); } } return Maybe.absent("Not a primitive or boxed primitive: "+type); }  static boolean unboxSafely(Boolean ref, boolean valueIfNull); static Maybe<Class<?>> getPrimitiveType(String typeName); static Maybe<String> getPrimitiveName(Class<?> type); static Class<?> boxedType(Class<?> type); static TypeToken<?> boxedTypeToken(Type type); static boolean isPrimitiveOrBoxedObject(Object o); static boolean isPrimitiveOrBoxedClass(Class<?> t); static void setInArray(Object target, int index, Object value, Class<?> type); static final ImmutableBiMap<Class<?>, Class<?>> PRIMITIVE_TO_BOXED; }
@Test public static void getPrimitive() { Assert.assertEquals(Boxing.getPrimitiveName(Integer.class).get(), "int"); }