public final class Primitives extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isPrimitive(Type type)
Returns true if this type is a primitive.
|
static boolean |
isWrapperType(Type type)
|
static <T> Class<T> |
unwrap(Class<T> type)
Returns the corresponding primitive type of
type if it is a wrapper
type; otherwise returns type itself. |
static <T> Class<T> |
wrap(Class<T> type)
Returns the corresponding wrapper type of
type if it is a primitive
type; otherwise returns type itself. |
public static boolean isPrimitive(Type type)
public static boolean isWrapperType(Type type)
Class.isPrimitive()public static <T> Class<T> wrap(Class<T> type)
type if it is a primitive
type; otherwise returns type itself. Idempotent.
wrap(int.class) == Integer.class
wrap(Integer.class) == Integer.class
wrap(String.class) == String.class