Class TypeSupport
java.lang.Object
com.sun.jdo.spi.persistence.support.ejb.ejbqlc.TypeSupport
Helper class to support type info access.
A type info is statically an object, internally the helper uses the type name
as type info. The helper uses a model instance to access meta model info and
uses a NameMapper to map EJB names to JDO names and vice versa.
- Author:
- Michael Bouschen, Shing Wai Chan
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ObjectRepresents the type java.math.BigDecimal.static final ObjectRepresents the type java.math.BigInteger.static final ObjectRepresents the wrapper class type boolean.static final ObjectRepresents the primitive type boolean.static final ObjectRepresents the wrapper class type byte.static final ObjectRepresents the primitive type byte.static final ObjectRepresents the wrapper class type char.static final ObjectRepresents the primitive type char.protected static final SetSet of names of date and time types.static final ObjectRepresents the wrapper class type double.static final ObjectRepresents the primitive type double.static final ObjectRepresents the internal error type.static final ObjectRepresents the wrapper class type float.static final ObjectRepresents the primitive type float.static final ObjectRepresents the wrapper class type int.static final ObjectRepresents the primitive type int.static final ObjectRepresents the wrapper class type long.static final ObjectRepresents the primitive type long.protected com.sun.jdo.api.persistence.model.ModelMeta data access.protected static final ResourceBundleI18N support.protected NameMapperName mapping EJB <-> JDO.protected static final SetSet of names of numeric types.protected static final SetSet of names of numeric wrapper classes.static final ObjectRepresents the wrapper class type short.static final ObjectRepresents the primitive type short.static final ObjectRepresents the type java.lang.String. -
Constructor Summary
ConstructorsConstructorDescriptionTypeSupport(com.sun.jdo.api.persistence.model.Model model, NameMapper nameMapper) Creates a new TypeSupport using the specified model instance to access meta data and the specified nameMapper for EJB <-> JDO name mapping. -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectbinaryNumericPromotion(Object left, Object right) Implements binary numeric promotion as defined in the Java Language Specification section 5.6.2getAbstractSchemaForTypeInfo(Object typeInfo) Returns the typeInfo (the ejb name) for the specified abstract schema.getAvgReturnType(Object type) Return JDO QL return type for Avg function for a given type.getElementType(Object fieldInfo) Returns the type info of the element type if the specified field info denotes a collection relationship.getFieldInfo(Object typeInfo, String fieldName) Returns the field info for the specified field of the specified type.getFieldType(Object typeInfo, String fieldName) Returns the type info for the type of the given field.getMinMaxReturnType(Object type) Return JDO QL return type for Min/Max function for a given type.getPCForTypeInfo(Object typeInfo) Gets the name of the persistence-capable class which corresponds to the specified typeInfo (assuming an ejb name).static ObjectgetPrimitiveType(Object type) Returns the type info for a primitive type.getSumReturnType(Object type) Return JDO QL return type for Sum function for a given type.getTypeInfo(Class clazz) The method returns a type info by type name by class object.getTypeInfo(String name) The method returns a type info by type name.getTypeInfoForAbstractSchema(String abstractSchema) Returns the typeInfo (the ejb name) for the specified abstract schema.static StringgetTypeName(Object type) Returns the type name for a specified type info.static ObjectgetWrapperType(Object type) Returns the type info for a wrapper class type.booleanhasLocalInterface(Object typeInfo) Returnstrueif the bean with the specified ejb name has a local interface.booleanhasRemoteInterface(Object typeInfo) Returnstrueif the bean with the specified ejb name has a remote interface.static booleanisBooleanType(Object type) Returnstrueif type is boolean or java.lang.Booleanstatic booleanisCharType(Object type) Returnstrueif type is char or java.lang.CharacterbooleanisCollectionType(Object type) Returnstrueif type is a collection type.booleanisCompatibleWith(Object left, Object right) Implements type compatibility.booleanisDateTimeType(Object type) Returnstrueif type is a date or time typestatic booleanisDoubleType(Object type) Returnstrueif type is double or java.lang.Double.booleanReturnstrueif the specified type info denotes an ejb name.booleanisEjbOrInterfaceName(Object typeInfo) Returnstrueif the specified type info denotes an ejb name or the name of a local interface or the name of a remote interface.static booleanisErrorType(Object type) Returnstrueif type denotes the error type.static booleanisFloatingPointType(Object type) Returnstrueif type is a floating point type or wrapper class of a floating point type.static booleanReturnstrueif type is int or java.lang.IntegerbooleanisLocalInterface(Object typeInfo) Returnstrueif the specified type info denotes a local interface.booleanisLocalInterfaceOfEjb(Object typeInfo, String ejbName) Returnstrueif the specified type info denotes the local interface of the bean with the specified ejb name.static booleanisNumberType(Object type) Returnstrueif type is a NumerType, which means it is either a numeric primitive or a numeric wrapper class.static booleanisNumericType(Object type) Returnstrueif type is a primitive numeric type such as byte, int etc.static booleanisNumericWrapperType(Object type) Returnstrueif type is a wrapper class of a primitive numeric type such as java.lang.Byte, java.lang.Integer etc.booleanisOrderableType(Object type) Returnstrueif type is an orderable typebooleanisRelationship(Object fieldInfo) Returnstrueif the specified field info denotes a relationship field.booleanisRemoteInterface(Object typeInfo) Returnstrueif the specified type info denotes a remote interface.booleanisRemoteInterfaceOfEjb(Object typeInfo, String ejbName) Returnstrueif the specified type info denotes the remote interface of the bean with the specified ejb name.static booleanisStringType(Object type) Returnstrueif type denotes java.lang.String.static ObjectunaryNumericPromotion(Object type) Implements unray numeric promotion as defined in the Java Language Specification section 5.6.1
-
Field Details
-
errorType
Represents the internal error type. -
booleanType
Represents the primitive type boolean. -
byteType
Represents the primitive type byte. -
shortType
Represents the primitive type short. -
charType
Represents the primitive type char. -
intType
Represents the primitive type int. -
longType
Represents the primitive type long. -
floatType
Represents the primitive type float. -
doubleType
Represents the primitive type double. -
booleanClassType
Represents the wrapper class type boolean. -
byteClassType
Represents the wrapper class type byte. -
shortClassType
Represents the wrapper class type short. -
characterClassType
Represents the wrapper class type char. -
integerClassType
Represents the wrapper class type int. -
longClassType
Represents the wrapper class type long. -
floatClassType
Represents the wrapper class type float. -
doubleClassType
Represents the wrapper class type double. -
stringType
Represents the type java.lang.String. -
bigDecimalType
Represents the type java.math.BigDecimal. -
bigIntegerType
Represents the type java.math.BigInteger. -
numericTypes
Set of names of numeric types. -
numericWrapperTypes
Set of names of numeric wrapper classes. -
dateTimeTypes
Set of names of date and time types. -
model
protected com.sun.jdo.api.persistence.model.Model modelMeta data access. -
nameMapper
Name mapping EJB <-> JDO. -
msgs
I18N support.
-
-
Constructor Details
-
TypeSupport
Creates a new TypeSupport using the specified model instance to access meta data and the specified nameMapper for EJB <-> JDO name mapping.
-
-
Method Details
-
getTypeInfo
The method returns a type info by type name. If the type name denotes a class the name should be fully qualified. The method uses the type name as type info. -
getTypeInfo
The method returns a type info by type name by class object. -
isErrorType
Returnstrueif type denotes the error type. -
isBooleanType
Returnstrueif type is boolean or java.lang.Boolean -
isCharType
Returnstrueif type is char or java.lang.Character -
isIntType
Returnstrueif type is int or java.lang.Integer -
isDoubleType
Returnstrueif type is double or java.lang.Double. -
isNumericType
Returnstrueif type is a primitive numeric type such as byte, int etc. -
isNumericWrapperType
Returnstrueif type is a wrapper class of a primitive numeric type such as java.lang.Byte, java.lang.Integer etc. -
isNumberType
Returnstrueif type is a NumerType, which means it is either a numeric primitive or a numeric wrapper class. -
isFloatingPointType
Returnstrueif type is a floating point type or wrapper class of a floating point type. -
isStringType
Returnstrueif type denotes java.lang.String. -
isCollectionType
Returnstrueif type is a collection type. -
isDateTimeType
Returnstrueif type is a date or time type -
isOrderableType
Returnstrueif type is an orderable type -
getPrimitiveType
Returns the type info for a primitive type. The method returnserrorTypeif the specified type is not a primitive type. -
getWrapperType
Returns the type info for a wrapper class type. The method returnserrorTypeif the specified type is not a wrapper class type. -
binaryNumericPromotion
Implements binary numeric promotion as defined in the Java Language Specification section 5.6.2 -
unaryNumericPromotion
Implements unray numeric promotion as defined in the Java Language Specification section 5.6.1 -
isCompatibleWith
Implements type compatibility. The method returnstrueif left is compatible with right. This is equivalent to rightClass.isAssignableFrom(leftClass). Note, the method does not support inheritance. -
getTypeName
Returns the type name for a specified type info. -
getTypeInfoForAbstractSchema
Returns the typeInfo (the ejb name) for the specified abstract schema. -
getAbstractSchemaForTypeInfo
Returns the typeInfo (the ejb name) for the specified abstract schema. -
getFieldType
Returns the type info for the type of the given field. -
getFieldInfo
Returns the field info for the specified field of the specified type. The field info is opaque for the caller. MethodsisRelationship(java.lang.Object)andgetElementType(java.lang.Object)allow to get details for a given field info. -
isRelationship
Returnstrueif the specified field info denotes a relationship field. -
getElementType
Returns the type info of the element type if the specified field info denotes a collection relationship. Otherwise it returnsnull. -
getPCForTypeInfo
Gets the name of the persistence-capable class which corresponds to the specified typeInfo (assuming an ejb name). The method returs the type name of the specified typeInfo, it the typeInfo does not denote an ejb-name (e.g. a local or remote interface). -
isEjbName
Returnstrueif the specified type info denotes an ejb name. -
isEjbOrInterfaceName
Returnstrueif the specified type info denotes an ejb name or the name of a local interface or the name of a remote interface. -
isRemoteInterfaceOfEjb
Returnstrueif the specified type info denotes the remote interface of the bean with the specified ejb name. -
isLocalInterfaceOfEjb
Returnstrueif the specified type info denotes the local interface of the bean with the specified ejb name. -
isRemoteInterface
Returnstrueif the specified type info denotes a remote interface. -
isLocalInterface
Returnstrueif the specified type info denotes a local interface. -
hasRemoteInterface
Returnstrueif the bean with the specified ejb name has a remote interface. -
hasLocalInterface
Returnstrueif the bean with the specified ejb name has a local interface. -
getSumReturnType
Return JDO QL return type for Sum function for a given type.- Parameters:
type- is a number data type
-
getAvgReturnType
Return JDO QL return type for Avg function for a given type.- Parameters:
type- is a number data type
-
getMinMaxReturnType
Return JDO QL return type for Min/Max function for a given type.- Parameters:
type- is an orderable data type
-