public final class JavaTypes extends Object
Modifier and Type | Class and Description |
---|---|
static class |
JavaTypes.Type
Provides an enumeration of the supported Java types.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
castIsAllowed(JavaTypes.Type originalType,
JavaTypes.Type resultType)
Determines whether the cast from the first given type to the second given type is allowed.
|
static boolean |
castIsSafe(JavaTypes.Type sourceType,
JavaTypes.Type destinationType) |
static JavaTypes.Type |
getArrayBySimpleType(JavaTypes.Type type)
Retrieves the array type for the corresponding type.
|
static JavaTypes.Type |
getByClass(Class<?> clazz)
Retrieves the type for the specified class.
|
static JavaTypes.Type |
getByClassName(String name)
Retrieves the type for the specified class name.
|
static JavaTypes.Type |
getByCode(int code)
Retrieves the type for the specified code.
|
static JavaTypes.Type |
getByName(String name)
Retrieves the type for the specified name.
|
static boolean |
isAutocastableTo(JavaTypes.Type type1,
JavaTypes.Type type2)
Indicates whether a type may be casted to another one.
|
static boolean |
isNumericType(JavaTypes.Type type)
Returns whether or not the given type is numeric.
|
static boolean |
supportEqualUnequalEquations(JavaTypes.Type type1,
JavaTypes.Type type2)
Returns whether two types are comparable with == and !=.
|
static boolean |
supportOrder(JavaTypes.Type type1,
JavaTypes.Type type2)
Returns whether two types are comparable with ==, !=, <=, <, >=, >.
|
public static JavaTypes.Type getByName(String name) throws IllegalArgumentException
name
- the nameIllegalArgumentException
public static JavaTypes.Type getByCode(int code) throws IllegalArgumentException
code
- the codeIllegalArgumentException
public static JavaTypes.Type getByClassName(String name) throws IllegalArgumentException
name
- the class nameIllegalArgumentException
public static JavaTypes.Type getByClass(Class<?> clazz) throws IllegalArgumentException
clazz
- the classIllegalArgumentException
public static JavaTypes.Type getArrayBySimpleType(JavaTypes.Type type)
public static boolean supportEqualUnequalEquations(JavaTypes.Type type1, JavaTypes.Type type2)
type1
- first input typetype2
- second input typepublic static boolean supportOrder(JavaTypes.Type type1, JavaTypes.Type type2)
type1
- first input typetype2
- second input typepublic static boolean isAutocastableTo(JavaTypes.Type type1, JavaTypes.Type type2)
type1
- the type to be castedtype2
- the target typetrue
if type1 is castable to type2, false
otherwisepublic static boolean isNumericType(JavaTypes.Type type)
type
- the type to checktrue
if the type is numeric, otherwise false
public static boolean castIsAllowed(JavaTypes.Type originalType, JavaTypes.Type resultType)
originalType
- the type which is checked for cast-abilityresultType
- the target type of the attempted casttrue
if the cast is allowed, otherwise false
public static boolean castIsSafe(JavaTypes.Type sourceType, JavaTypes.Type destinationType)
sourceType
- destinationType
- castIsAllowed(Type, Type)