public class TypeUtil extends Object
Modifier and Type | Field and Description |
---|---|
static Class<? extends Collection<Object>> |
ARRAY_TYPE
Class type used to indicate a Java array
|
static String |
CALENDAR_DATE_ALIAS
Alias for a java.util.Calendar that includes only date information
|
static String |
CALENDAR_DATETIME_ALIAS
Alias for a java.util.Calendar that includes both date and time information.
|
static String |
CALENDAR_TIME_ALIAS
Alias for a java.util.Calendar that includes only time information
|
static String |
DATE_ALIAS
Alias for the java.util.Date class that includes only date information
|
static String |
DATETIME_ALIAS
Alias for a java.util.Date that includes both date and time information.
|
static String |
TIME_ALIAS
Alias for a java.util.Date that includes only time information
|
Modifier and Type | Method and Description |
---|---|
static boolean |
isAliasOnly(String alias)
Returns true if the type alias is not used to register a
type handler for its associated class.
|
static boolean |
isAssignable(Class<?> to,
Class<?> from)
Returns true if to.isAssignableFrom(from) after converting
primitive values of to to its object counterpart.
|
static Class<?> |
toAggregationType(String type) |
static Class<?> |
toBeanType(ClassLoader classLoader,
String type) |
static Class<? extends Collection<Object>> |
toCollectionType(String type)
Returns the collection Class object for a collection class name or type alias.
|
static Class<?> |
toType(ClassLoader classLoader,
String type)
Returns the Class object for a class name or type alias.
|
static Class<?> |
toWrapperClass(Class<?> type)
Converts primitive types to their wrapper counterparts.
|
public static final String DATETIME_ALIAS
public static final String DATE_ALIAS
public static final String TIME_ALIAS
public static final String CALENDAR_DATETIME_ALIAS
Calendar
classes.public static final String CALENDAR_TIME_ALIAS
public static final String CALENDAR_DATE_ALIAS
public static final Class<? extends Collection<Object>> ARRAY_TYPE
public static boolean isAssignable(Class<?> to, Class<?> from)
to
- the class or primitive to test assignability tofrom
- the class to test assignability frompublic static Class<?> toWrapperClass(Class<?> type)
type
- the class type to convertpublic static Class<?> toType(ClassLoader classLoader, String type)
Alias | Class or Primitive |
---|---|
string | java.lang.String |
boolean | java.lang.Boolean |
byte | java.lang.Byte |
int | java.lang.Integer |
integer | java.lang.Integer |
short | java.lang.Short |
char | java.lang.Character |
character | java.lang.Character |
long | java.lang.Long |
float | java.lang.Float |
double | java.lang.Double |
bigdecimal | java.math.BigDecimal |
decimal | java.math.BigDecimal |
biginteger | java.math.BigInteger |
uuid | java.util.UUID |
url | java.net.URL |
date | java.util.Date |
time | java.util.Date |
datetime | java.util.Date |
calendar | java.util.Calendar |
classLoader
- the ClassLoader
for loading classestype
- the fully qualified class name or type aliaspublic static boolean isAliasOnly(String alias)
alias
- the type alias to checkpublic static Class<? extends Collection<Object>> toCollectionType(String type)
Alias | Class or Primitive |
---|---|
array | Java Array |
list | java.util.ArrayList |
set | java.util.HashSet |
type
- the fully qualified class name or type alias of the collectionARRAY_TYPE
for array,
or null if the type name is invalidpublic static Class<?> toBeanType(ClassLoader classLoader, String type)