public class Boxing
extends java.lang.Object
Primitives
Modifier and Type | Field and Description |
---|---|
static <any> |
PRIMITIVE_TO_BOXED |
Constructor and Description |
---|
Boxing() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Class<?> |
boxedType(java.lang.Class<?> type) |
static <any> |
boxedTypeToken(java.lang.reflect.Type type) |
static Maybe<java.lang.String> |
getPrimitiveName(java.lang.Class<?> type)
returns name of primitive corresponding to the given (boxed or unboxed) 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 boolean |
isPrimitiveOrBoxedClass(java.lang.Class<?> t) |
static boolean |
isPrimitiveOrBoxedObject(java.lang.Object o) |
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 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 Maybe<java.lang.String> getPrimitiveName(java.lang.Class<?> type)
public static java.lang.Class<?> boxedType(java.lang.Class<?> type)
public static <any> boxedTypeToken(java.lang.reflect.Type type)
public static boolean isPrimitiveOrBoxedObject(java.lang.Object o)
public static boolean isPrimitiveOrBoxedClass(java.lang.Class<?> t)
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