|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.esper.util.JavaClassHelper
public class JavaClassHelper
Helper for questions about Java classes such as
what is the boxed type for a primitive type
is this a numeric type.
Constructor Summary | |
---|---|
JavaClassHelper()
|
Method Summary | |
---|---|
static Number |
coerceNumber(Number numToCoerce,
Class resultType)
Coerce the given number to the given type. |
static Class |
getArithmaticCoercionType(Class typeOne,
Class typeTwo)
Returns the coercion type for the 2 numeric types for use in arithmatic. |
static String |
getBoxedClassName(String className)
Returns for the class name given the class name of the boxed (wrapped) type if the class name is one of the Java primitive types. |
static Class |
getBoxedType(Class clazz)
Returns the boxed class for the given class, or the class itself if already boxed or not a primitive type. |
static Class |
getCommonCoercionType(Class[] types)
Determines a common denominator type to which one or more types can be casted or coerced. |
static Class |
getCompareToCoercionType(Class typeOne,
Class typeTwo)
Returns for 2 classes to be compared via relational operator the Class type of common comparison. |
static boolean |
isAssignmentCompatible(Class parameterType,
Class parameterization)
Returns true if 2 classes are assignment compatible. |
static boolean |
isBoolean(Class clazz)
Determines if the class passed in is a boolean boxed or unboxed type. |
static boolean |
isFloatingPointClass(Class clazz)
Returns true if the supplied type is a floating point number. |
static boolean |
isFloatingPointNumber(Number number)
Returns true if the Number instance is a floating point number. |
static boolean |
isJavaBuiltinDataType(Class clazz)
Returns true if the class passed in is a Java built-in data type (primitive or wrapper) including String. |
static boolean |
isNumeric(Class clazz)
Determines if the class passed in is one of the numeric classes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JavaClassHelper()
Method Detail |
---|
public static Class getBoxedType(Class clazz)
clazz
- is the class to return the boxed class for
public static boolean isNumeric(Class clazz)
clazz
- to check
public static final boolean isAssignmentCompatible(Class parameterType, Class parameterization)
parameterType
- type to assign fromparameterization
- type to assign to
public static boolean isBoolean(Class clazz)
clazz
- to check
public static Class getArithmaticCoercionType(Class typeOne, Class typeTwo) throws CoercionException
typeOne
- typeTwo
-
CoercionException
- if types don't allow coercionpublic static Number coerceNumber(Number numToCoerce, Class resultType)
numToCoerce
- is the number to coerce to the given typeresultType
- is the result type to return
public static boolean isFloatingPointNumber(Number number)
number
- to check
public static boolean isFloatingPointClass(Class clazz)
clazz
- to check
public static Class getCompareToCoercionType(Class typeOne, Class typeTwo)
typeOne
- typeTwo
-
IllegalArgumentException
- if the types cannot be comparedpublic static String getBoxedClassName(String className)
className
- is a class name, a Java primitive type or other class
public static boolean isJavaBuiltinDataType(Class clazz)
clazz
- to check
public static Class getCommonCoercionType(Class[] types) throws CoercionException
Null values are allowed as part of the input and indicate a 'null' constant value in an expression tree. Such as value doesn't have any type and can be ignored in determining a result type.
For numeric types, determines a coercion type that all types can be converted to via the method getArithmaticCoercionType.
Indicates that there is no common denominator type by throwing CoercionException
.
types
- is an array of one or more types, which can be Java built-in (primitive or wrapper)
or user types
CoercionException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |