public class TypeUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.util.HashMap |
PRIMITIVE_TYPE_MAP |
private static TypeConverter |
typeConverter |
Constructor and Description |
---|
TypeUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
canConvert(java.lang.Object object,
java.lang.Class toType)
Returns true if the global converter can convert the supplied
object to the specified type.
|
static java.lang.Object |
convert(java.lang.Object object,
java.lang.Class toType)
Converts the supplied object to the specified type.
|
static TypeConverter |
getTypeConverter()
Returns the current type converter.
|
static void |
setTypeConverter(TypeConverter converter)
Install an alternative type converter.
|
static java.lang.Class |
wrapPrimitive(java.lang.Class p)
Return the appropriate wrapper type for the specified class.
|
private static TypeConverter typeConverter
private static final java.util.HashMap PRIMITIVE_TYPE_MAP
public static void setTypeConverter(TypeConverter converter)
converter
- new TypeConverterpublic static TypeConverter getTypeConverter()
public static boolean canConvert(java.lang.Object object, java.lang.Class toType)
object
- object to testtoType
- target classpublic static java.lang.Object convert(java.lang.Object object, java.lang.Class toType)
object
- object to converttoType
- target classpublic static java.lang.Class wrapPrimitive(java.lang.Class p)
p
- Class for which to retrieve a wrapper class.p
is primitive, else p
.