public final class TypeMagic extends Object
| Constructor and Description |
|---|
TypeMagic() |
| Modifier and Type | Method and Description |
|---|---|
static Object |
box(Object t) |
static Class<?> |
classForType(Type t)
This is a surprisingly intractable problem in Java: "Type" pretty much represents all possible states of reified
and unreified type information, and each kind of Type has different, mutually exclusive, and often unintended
ways of uncovering its (un-reified) class.
|
static Object |
unbox(Object t) |
static <T> Class<T> |
unwrapPrimitive(Class<T> type) |
static <T> Class<T> |
wrapPrimitive(Class<T> type) |
@Nullable public static Class<?> classForType(Type t)
Generally it's much safer to use this for the type from a *field* than a blind type from an argument.
t - the type to checkt