public class Boxing
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static com.google.common.collect.ImmutableBiMap<java.lang.Class<?>,java.lang.Class<?>> |
PRIMITIVE_TO_BOXED |
Constructor and Description |
---|
Boxing() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Class<?> |
boxedType(java.lang.Class<?> type) |
static Maybe<java.lang.Class<?>> |
getPrimitiveType(java.lang.String typeName)
Returns the unboxed type for the given primitive type name, if available;
e.g.
|
static void |
setInArray(java.lang.Object target,
int index,
java.lang.Object value,
java.lang.Class<?> type)
sets the given element in an array to the indicated value;
if the type is a primitive type, the appropriate primitive method is used
|
static boolean |
unboxSafely(java.lang.Boolean ref,
boolean valueIfNull) |
public static final com.google.common.collect.ImmutableBiMap<java.lang.Class<?>,java.lang.Class<?>> PRIMITIVE_TO_BOXED
public static boolean unboxSafely(java.lang.Boolean ref, boolean valueIfNull)
public static Maybe<java.lang.Class<?>> getPrimitiveType(java.lang.String typeName)
Integer.TYPE
for int
(distinct from Integer.class
),
or null if not a primitive.public static java.lang.Class<?> boxedType(java.lang.Class<?> type)
public static void setInArray(java.lang.Object target, int index, java.lang.Object value, java.lang.Class<?> type)
this is needed because arrays do not deal with autoboxing