public abstract class TypeUtils
extends java.lang.Object
| Constructor | Description |
|---|---|
TypeUtils() |
| Modifier and Type | Method | Description |
|---|---|---|
static java.lang.Class<?> |
getPrimitiveWrapper(java.lang.Class<?> primitiveType) |
Gets the wrapper object class for the given primitive type class.
|
static boolean |
isAssignable(java.lang.Class<?> lhsType,
java.lang.Class<?> rhsType) |
Check if the right-hand side type may be assigned to the left-hand side
type, assuming setting by reflection.
|
static boolean |
isAssignableValue(java.lang.Class<?> type,
java.lang.Object value) |
Determine if the given type is assignable from the given value,
assuming setting by reflection.
|
static boolean |
isPrimitiveArray(java.lang.Class<?> clazz) |
Check if the given class represents an array of primitives,
i.e.
|
static boolean |
isPrimitiveWrapper(java.lang.Class<?> clazz) |
Check if the given class represents a primitive wrapper,
i.e.
|
static boolean |
isPrimitiveWrapperArray(java.lang.Class<?> clazz) |
Check if the given class represents an array of primitive wrappers,
i.e.
|
static java.lang.Class<?>[] |
wrappersToPrimitives(java.lang.Class<?>[] classes) |
Converts the specified array of wrapper Class objects to an array of
its corresponding primitive Class objects.
|
static java.lang.Class<?> |
wrapperToPrimitive(java.lang.Class<?> cls) |
Converts the specified wrapper class to its corresponding primitive
class.
|
public static boolean isPrimitiveWrapper(java.lang.Class<?> clazz)
clazz - the class to checkpublic static boolean isPrimitiveArray(java.lang.Class<?> clazz)
clazz - the class to checkpublic static boolean isPrimitiveWrapperArray(java.lang.Class<?> clazz)
clazz - the class to checkpublic static boolean isAssignable(java.lang.Class<?> lhsType,
java.lang.Class<?> rhsType)
lhsType - the target typerhsType - the value type that should be assigned to the target typepublic static boolean isAssignableValue(java.lang.Class<?> type,
java.lang.Object value)
type - the target typevalue - the value that should be assigned to the typepublic static java.lang.Class<?> getPrimitiveWrapper(java.lang.Class<?> primitiveType)
boolean.class returns Boolean.classprimitiveType - the primitive type class for which a match is to be foundpublic static java.lang.Class<?> wrapperToPrimitive(java.lang.Class<?> cls)
Converts the specified wrapper class to its corresponding primitive class.
This method is the counter part of primitiveToWrapper().
If the passed in class is a wrapper class for a primitive type, this
primitive type will be returned (e.g. Integer.TYPE for
Integer.class). For other classes, or if the parameter is
null, the return value is null.
cls - the class to convert, may be nullcls is a wrapper class, null otherwisepublic static java.lang.Class<?>[] wrappersToPrimitives(java.lang.Class<?>[] classes)
Converts the specified array of wrapper Class objects to an array of its corresponding primitive Class objects.
This method invokes wrapperToPrimitive() for each element
of the passed in array.
classes - the class array to convert, may be null or emptynull if null input.
Empty array if an empty array passed in.wrapperToPrimitive(Class)Copyright © 2008–2018 The Aspectran Project. All rights reserved.