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 MathType
bigDecimalType
Represents the type java.math.BigDecimalMathType
bigIntegerType
Represents the type java.math.BigIntegerBooleanType
booleanType
Represents the type boolean.IntegralType
byteType
Represents the type byte.IntegralType
charType
Represents the type char.protected ClassLoader
classLoader
Store class loader for Class.forName lookupFloatingPointType
doubleType
Represents the type double.static ErrorType
errorType
Represents the internal error type.FloatingPointType
floatType
Represents the type float.IntegralType
intType
Represents the type int.IntegralType
longType
Represents the type long.protected Model
model
The model used to access class meta infostatic NullType
nullType
Represents the type of nullIntegralType
shortType
Represents the type short.StringType
stringType
Represents the type java.lang.String.protected Map
types
The list of actual known types.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Type
binaryNumericPromotion(Type left, Type right)
Implements binary numeric promotion as defined in the Java Language Specification section 5.6.2Type
checkType(Class clazz)
Checks for the type with the specified name.Type
checkType(String name)
Checks for the type with the specified name.Type
getAvgReturnType(Type type)
Return JDO QL return type for Avg function for a given type.static TypeTable
getInstance(ClassLoader classLoader)
Type
getMinMaxReturnType(Type type)
Return JDO QL return type for Min/Max function for a given type.Type
getSumReturnType(Type type)
Return JDO QL return type for Sum function for a given type.boolean
isBooleanType(Type type)
Returns true if type is boolean or java.lang.Booleanboolean
isCharType(Type type)
Returns true if type is char or java.lang.Characterboolean
isCollectionType(Type type)
Returns true if type denotes a collection type.boolean
isDoubleType(Type type)
Returns true if type is double or java.lang.Doubleboolean
isFloatingPointType(Type type)
Returns true if type is a floating point type or a Java wrapper class type wrapping a floating point integral type.boolean
isIntegralType(Type type)
Returns true if type is an integral type or a Java wrapper class type wrapping an integral type.boolean
isIntType(Type type)
Returns true if type is int or java.lang.Integerboolean
isJavaLangMathType(Type type)
Returns true if type denotes a collection type.boolean
isNumberType(Type type)
Returns true if type is a NumericType or compatible to java.lang.Numberboolean
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.static void
removeInstance(ClassLoader classLoader)
Type
unaryNumericPromotion(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
-
-