Class TypeTable
- java.lang.Object
-
- com.sun.jdo.spi.persistence.support.sqlstore.query.util.type.TypeTable
-
public class TypeTable extends Object
- Version:
- 0.1
- Author:
- Michael Bouschen, Shing Wai Chan
-
-
Field Summary
Fields Modifier and Type Field Description MathTypebigDecimalTypeRepresents the type java.math.BigDecimalMathTypebigIntegerTypeRepresents the type java.math.BigIntegerBooleanTypebooleanTypeRepresents the type boolean.IntegralTypebyteTypeRepresents the type byte.IntegralTypecharTypeRepresents the type char.protected ClassLoaderclassLoaderStore class loader for Class.forName lookupFloatingPointTypedoubleTypeRepresents the type double.static ErrorTypeerrorTypeRepresents the internal error type.FloatingPointTypefloatTypeRepresents the type float.IntegralTypeintTypeRepresents the type int.IntegralTypelongTypeRepresents the type long.protected ModelmodelThe model used to access class meta infostatic NullTypenullTypeRepresents the type of nullIntegralTypeshortTypeRepresents the type short.StringTypestringTypeRepresents the type java.lang.String.protected MaptypesThe list of actual known types.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TypebinaryNumericPromotion(Type left, Type right)Implements binary numeric promotion as defined in the Java Language Specification section 5.6.2TypecheckType(Class clazz)Checks for the type with the specified name.TypecheckType(String name)Checks for the type with the specified name.TypegetAvgReturnType(Type type)Return JDO QL return type for Avg function for a given type.static TypeTablegetInstance(ClassLoader classLoader)TypegetMinMaxReturnType(Type type)Return JDO QL return type for Min/Max function for a given type.TypegetSumReturnType(Type type)Return JDO QL return type for Sum function for a given type.booleanisBooleanType(Type type)Returns true if type is boolean or java.lang.BooleanbooleanisCharType(Type type)Returns true if type is char or java.lang.CharacterbooleanisCollectionType(Type type)Returns true if type denotes a collection type.booleanisDoubleType(Type type)Returns true if type is double or java.lang.DoublebooleanisFloatingPointType(Type type)Returns true if type is a floating point type or a Java wrapper class type wrapping a floating point integral type.booleanisIntegralType(Type type)Returns true if type is an integral type or a Java wrapper class type wrapping an integral type.booleanisIntType(Type type)Returns true if type is int or java.lang.IntegerbooleanisJavaLangMathType(Type type)Returns true if type denotes a collection type.booleanisNumberType(Type type)Returns true if type is a NumericType or compatible to java.lang.NumberbooleanisPersistenceCapableType(Type type)Returns true if type denotes a pertsistence capable class Note, it returns false for non ClassType values, especially for NullType and ErrorType.static voidremoveInstance(ClassLoader classLoader)TypeunaryNumericPromotion(Type type)Implements unray numeric promotion as defined in the Java Language Specification section 5.6.1
-
-
-
Field Detail
-
nullType
public static final NullType nullType
Represents the type of null
-
errorType
public static final ErrorType errorType
Represents the internal error type.
-
booleanType
public BooleanType booleanType
Represents the type boolean.
-
charType
public IntegralType charType
Represents the type char.
-
byteType
public IntegralType byteType
Represents the type byte.
-
shortType
public IntegralType shortType
Represents the type short.
-
intType
public IntegralType intType
Represents the type int.
-
longType
public IntegralType longType
Represents the type long.
-
floatType
public FloatingPointType floatType
Represents the type float.
-
doubleType
public FloatingPointType doubleType
Represents the type double.
-
stringType
public StringType stringType
Represents the type java.lang.String.
-
bigDecimalType
public MathType bigDecimalType
Represents the type java.math.BigDecimal
-
bigIntegerType
public MathType bigIntegerType
Represents the type java.math.BigInteger
-
model
protected Model model
The model used to access class meta info
-
classLoader
protected ClassLoader classLoader
Store class loader for Class.forName lookup
-
types
protected Map types
The list of actual known types.
-
-
Method Detail
-
getInstance
public static TypeTable getInstance(ClassLoader classLoader)
-
removeInstance
public static void removeInstance(ClassLoader classLoader)
-
checkType
public Type checkType(String name)
Checks for the type with the specified name. First the internal type table is checked. If the type is not found it checks Class.forName. If the type is found the internal type table is updated (optimization for further access). If the type is neither in the type table nor found by forName null is returned and the type table is not changed. Otherwise the Type representation of the type is returned.- Parameters:
name- the name of the type to be checked.- Returns:
- the Type object representing the type with the specified name or null when the type was not found.
-
checkType
public Type checkType(Class clazz)
Checks for the type with the specified name. First the internal type table is checked. If the type is not found it checks Class.forName. If the type is found the internal type table is updated (optimization for further access). If the type is neither in the type table nor found by forName null is returned and the type table is not changed. Otherwise the Type representation of the type is returned.- Parameters:
clazz- the name of the type to be checked.- Returns:
- the Type object representing the type with the specified name or null when the type was not found.
-
binaryNumericPromotion
public Type binaryNumericPromotion(Type left, Type right)
Implements binary numeric promotion as defined in the Java Language Specification section 5.6.2
-
unaryNumericPromotion
public Type unaryNumericPromotion(Type type)
Implements unray numeric promotion as defined in the Java Language Specification section 5.6.1
-
isNumberType
public boolean isNumberType(Type type)
Returns true if type is a NumericType or compatible to java.lang.Number
-
isIntegralType
public boolean isIntegralType(Type type)
Returns true if type is an integral type or a Java wrapper class type wrapping an integral type.
-
isFloatingPointType
public boolean isFloatingPointType(Type type)
Returns true if type is a floating point type or a Java wrapper class type wrapping a floating point integral type.
-
isDoubleType
public boolean isDoubleType(Type type)
Returns true if type is double or java.lang.Double
-
isIntType
public boolean isIntType(Type type)
Returns true if type is int or java.lang.Integer
-
isCharType
public boolean isCharType(Type type)
Returns true if type is char or java.lang.Character
-
isBooleanType
public boolean isBooleanType(Type type)
Returns true if type is boolean or java.lang.Boolean
-
isPersistenceCapableType
public boolean isPersistenceCapableType(Type type)
Returns true if type denotes a pertsistence capable class Note, it returns false for non ClassType values, especially for NullType and ErrorType.
-
isCollectionType
public boolean isCollectionType(Type type)
Returns true if type denotes a collection type. Note, it returns false for non ClassType values, especially for NullType and ErrorType.
-
isJavaLangMathType
public boolean isJavaLangMathType(Type type)
Returns true if type denotes a collection type. Note, it returns false for non ClassType values, especially for NullType and ErrorType.
-
getSumReturnType
public Type getSumReturnType(Type type)
Return JDO QL return type for Sum function for a given type.- Parameters:
type- is a number data type
-
getAvgReturnType
public Type getAvgReturnType(Type type)
Return JDO QL return type for Avg function for a given type.- Parameters:
type- is a number data type
-
-