Class GenericTypeHelper
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.GenericTypeHelper
-
- All Implemented Interfaces:
ITypeHelper
public class GenericTypeHelper extends java.lang.Object implements ITypeHelper
This generic implementation ofITypeHelper
wrapsITypeHelper
and delegates the calls to it.- Version:
- 2.4
- Author:
- Pascal Filion
- Since:
- 2.4
-
-
Constructor Summary
Constructors Constructor Description GenericTypeHelper(TypeHelper delegate)
Creates a newGenericTypeHelper
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IType
bigDecimal()
Retrieves the;@link IType} for;@link BigDecimal}.IType
bigInteger()
Retrieves the;@link IType} for;@link BigInteger}.IType
booleanType()
Retrieves the;@link IType} for;@link Boolean}.IType
byteType()
Retrieves the;@link IType} for;@link Byte}.IType
characterType()
Retrieves the;@link IType} for;@link Character}.IType
collectionType()
Retrieves the;@link IType} for;@link Collection}.IType
convertPrimitive(java.lang.Object type)
Converts the given;@link IType}, if it's representing a primitive type, into the class of the same type.IType
dateType()
Retrieves the;@link IType} for;@link Date}.IType
doubleType()
Retrieves the;@link IType} for;@link Double}.IType
enumType()
Retrieves the;@link IType} for;@link Enum}.IType
floatType()
Retrieves the;@link IType} for;@link Float}.IType
getType(java.lang.Class<?> type)
Returns the;@link IType} of the given Java type.IType
getType(java.lang.String typeName)
Retrieves the external class for the given fully qualified class name.IType
integerType()
Retrieves the;@link IType} for;@link Integer}.boolean
isBooleanType(java.lang.Object type)
Determines whether the given;@link IType} is a;@link Boolean}.boolean
isCollectionType(java.lang.Object type)
Determines whether the given;@link IType} is an instance of;@link Collection}.boolean
isDateType(java.lang.Object type)
Determines whether the given;@link IType} is a;@link Date},;@link Timestamp} or ;@link Calendar}.boolean
isEnumType(java.lang.Object type)
Determines whether the given;@link IType} is an instance of;@link Enum}.boolean
isFloatingType(java.lang.Object type)
Determines whether the given;@link IType} is an instance of a floating type, which is eitherFloat
,Double
, float or double.boolean
isIntegralType(java.lang.Object type)
Determines whether the given;@link IType} is an instance of a floating type, which is eitherInteger
,Long
, int or float.boolean
isMapType(java.lang.Object type)
Determines whether the given;@link IType} is an instance of;@link Map}.boolean
isNumericType(java.lang.Object type)
Determines whether the given;@link IType} is an instance of;@link Numeric}.boolean
isObjectType(java.lang.Object type)
Determines whether the given;@link IType} is the external form of;@link Object}.boolean
isPrimitiveType(java.lang.Object type)
Determines whether the given;@link IType} represents a primitive type.boolean
isStringType(java.lang.Object type)
Determines whether the given;@link IType} represents theString
class.IType
longType()
Retrieves the;@link IType} for;@link Long}.IType
longType(java.lang.Object type)
Converts the given;@link IType}, if it's the primitive long, into theLong
type.IType
mapType()
Retrieves the;@link IType} for;@link Map}.IType
numberType()
Retrieves the;@link IType} for;@link Number}.IType
objectType()
Retrieves the;@link IType} for;@link Object}.ITypeDeclaration
objectTypeDeclaration()
Returns the;@link Object } for the;@link IType} representing theObject
class.IType
primitiveBoolean()
Retrieves the;@link IType} for the primitive boolean.IType
primitiveByte()
Retrieves the;@link IType} for the primitive byte.IType
primitiveChar()
Retrieves the;@link IType} for the primitive char.IType
primitiveDouble()
Retrieves the;@link IType} for the primitive double.IType
primitiveFloat()
Retrieves the;@link IType} for the primitive float.IType
primitiveInteger()
Retrieves the;@link IType} for the primitive int.IType
primitiveLong()
Retrieves the;@link IType} for the primitive long.IType
primitiveShort()
Retrieves the;@link IType} for the primitive short.IType
shortType()
Retrieves the;@link IType} for;@link Short}.IType
stringType()
Retrieves the;@link IType} for;@link String}.IType
timestampType()
Retrieves the;@link IType} for;@link Timestamp}.IType
toBooleanType(java.lang.Object type)
Converts the given;@link IType}, if it's the primitive boolean, into theBoolean
type.IType
toByteType(java.lang.Object type)
Converts the given;@link IType}, if it's the primitive byte, into theByte
type.IType
toDoubleType(java.lang.Object type)
Converts the given;@link IType}, if it's the primitive double, into theDouble
type.IType
toFloatType(java.lang.Object type)
Converts the given;@link IType}, if it's the primitive float, into theFloat
type.IType
toIntegerType(java.lang.Object type)
Converts the given;@link IType}, if it's the primitive int, into theInteger
type.IType
toShortType(java.lang.Object type)
Converts the given;@link IType}, if it's the primitive short, into theShort
type.IType
unknownType()
Retrieves the;@link IType} that represents an unknown type.ITypeDeclaration
unknownTypeDeclaration()
Returns the;@link Object } for the;@link IType} representing an unknown type.
-
-
-
Constructor Detail
-
GenericTypeHelper
public GenericTypeHelper(TypeHelper delegate)
Creates a newGenericTypeHelper
.- Parameters:
delegate
- TheTypeHelper
that is wrapped by this one and all the calls are delegated to it
-
-
Method Detail
-
bigDecimal
public IType bigDecimal()
Retrieves the;@link IType} for;@link BigDecimal}.- Specified by:
bigDecimal
in interfaceITypeHelper
- Returns:
- The external form of the
BigDecimal
class
-
bigInteger
public IType bigInteger()
Retrieves the;@link IType} for;@link BigInteger}.- Specified by:
bigInteger
in interfaceITypeHelper
- Returns:
- The external form of the
BigInteger
class
-
booleanType
public IType booleanType()
Retrieves the;@link IType} for;@link Boolean}.- Specified by:
booleanType
in interfaceITypeHelper
- Returns:
- The external form of the
Boolean
class
-
byteType
public IType byteType()
Retrieves the;@link IType} for;@link Byte}.- Specified by:
byteType
in interfaceITypeHelper
- Returns:
- The external form of the
Byte
class
-
characterType
public IType characterType()
Retrieves the;@link IType} for;@link Character}.- Specified by:
characterType
in interfaceITypeHelper
- Returns:
- The external form of the
Character
class
-
collectionType
public IType collectionType()
Retrieves the;@link IType} for;@link Collection}.- Specified by:
collectionType
in interfaceITypeHelper
- Returns:
- The external form of the
Collection
class
-
convertPrimitive
public IType convertPrimitive(java.lang.Object type)
Converts the given;@link IType}, if it's representing a primitive type, into the class of the same type.- Specified by:
convertPrimitive
in interfaceITypeHelper
- Parameters:
type
- Type to possibly convert from the primitive into the class- Returns:
- The given;@link IType} if it's not a primitive type otherwise the primitive type will have been converted into the class of that primitive
-
dateType
public IType dateType()
Retrieves the;@link IType} for;@link Date}.- Specified by:
dateType
in interfaceITypeHelper
- Returns:
- The external form of the
Date
class
-
doubleType
public IType doubleType()
Retrieves the;@link IType} for;@link Double}.- Specified by:
doubleType
in interfaceITypeHelper
- Returns:
- The external form of the
Double
class
-
enumType
public IType enumType()
Retrieves the;@link IType} for;@link Enum}.- Specified by:
enumType
in interfaceITypeHelper
- Returns:
- The external form of the
Enum
class
-
floatType
public IType floatType()
Retrieves the;@link IType} for;@link Float}.- Specified by:
floatType
in interfaceITypeHelper
- Returns:
- The external form of the
Float
class
-
getType
public IType getType(java.lang.Class<?> type)
Returns the;@link IType} of the given Java type.- Specified by:
getType
in interfaceITypeHelper
- Parameters:
type
- The Java type for which its external form will be returned- Returns:
- The;@link IType} representing the given Java type
-
getType
public IType getType(java.lang.String typeName)
Retrieves the external class for the given fully qualified class name.- Specified by:
getType
in interfaceITypeHelper
- Parameters:
typeName
- The fully qualified class name of the class to retrieve- Returns:
- The external form of the class to retrieve
-
integerType
public IType integerType()
Retrieves the;@link IType} for;@link Integer}.- Specified by:
integerType
in interfaceITypeHelper
- Returns:
- The external form of the
Integer
class
-
isBooleanType
public boolean isBooleanType(java.lang.Object type)
Determines whether the given;@link IType} is a;@link Boolean}.- Specified by:
isBooleanType
in interfaceITypeHelper
- Parameters:
type
- The type to check it's assignability- Returns:
true
if the given;@link IType} is a;@link Boolean};false
otherwise
-
isCollectionType
public boolean isCollectionType(java.lang.Object type)
Determines whether the given;@link IType} is an instance of;@link Collection}.- Specified by:
isCollectionType
in interfaceITypeHelper
- Parameters:
type
- The type to check it's assignability- Returns:
true
if the given;@link IType} is an instance of;@link Collection};false
otherwise
-
isDateType
public boolean isDateType(java.lang.Object type)
Determines whether the given;@link IType} is a;@link Date},;@link Timestamp} or ;@link Calendar}.- Specified by:
isDateType
in interfaceITypeHelper
- Parameters:
type
- The type to check it's assignability- Returns:
true
if the given;@link IType} is a;@link Date},;@link Timestamp} or ;@link Calendar}
-
isEnumType
public boolean isEnumType(java.lang.Object type)
Determines whether the given;@link IType} is an instance of;@link Enum}.- Specified by:
isEnumType
in interfaceITypeHelper
- Parameters:
type
- The type to check it's assignability- Returns:
true
if the given;@link IType} is an instance of;@link Enum};false
otherwise
-
isFloatingType
public boolean isFloatingType(java.lang.Object type)
Determines whether the given;@link IType} is an instance of a floating type, which is eitherFloat
,Double
, float or double.- Specified by:
isFloatingType
in interfaceITypeHelper
- Parameters:
type
- The type to check it's assignability- Returns:
true
if the given;@link IType} is a floating type;false
otherwise
-
isIntegralType
public boolean isIntegralType(java.lang.Object type)
Determines whether the given;@link IType} is an instance of a floating type, which is eitherInteger
,Long
, int or float.- Specified by:
isIntegralType
in interfaceITypeHelper
- Parameters:
type
- The type to check it's assignability- Returns:
true
if the given;@link IType} is a integral type;false
otherwise
-
isMapType
public boolean isMapType(java.lang.Object type)
Determines whether the given;@link IType} is an instance of;@link Map}.- Specified by:
isMapType
in interfaceITypeHelper
- Parameters:
type
- The type to check it's assignability- Returns:
true
if the given;@link IType} is an instance of;@link Map};false
otherwise
-
isNumericType
public boolean isNumericType(java.lang.Object type)
Determines whether the given;@link IType} is an instance of;@link Numeric}.- Specified by:
isNumericType
in interfaceITypeHelper
- Parameters:
type
- The type to check it's assignability- Returns:
true
if the given;@link IType} is an instance of;@link Numeric};false
otherwise
-
isObjectType
public boolean isObjectType(java.lang.Object type)
Determines whether the given;@link IType} is the external form of;@link Object}.- Specified by:
isObjectType
in interfaceITypeHelper
- Parameters:
type
- The type to check it's assignability- Returns:
true
if the given;@link IType} is the external form of;@link Object}
-
isPrimitiveType
public boolean isPrimitiveType(java.lang.Object type)
Determines whether the given;@link IType} represents a primitive type.- Specified by:
isPrimitiveType
in interfaceITypeHelper
- Parameters:
type
- The type to check it's assignability- Returns:
true
if the given;@link IType} represents a primitive;false
otherwise
-
isStringType
public boolean isStringType(java.lang.Object type)
Determines whether the given;@link IType} represents theString
class.- Specified by:
isStringType
in interfaceITypeHelper
- Parameters:
type
- The type to check it's assignability- Returns:
true
if the given;@link IType} represents theString
class;false
otherwise
-
longType
public IType longType()
Retrieves the;@link IType} for;@link Long}.- Specified by:
longType
in interfaceITypeHelper
- Returns:
- The external form of the
Long
class
-
longType
public IType longType(java.lang.Object type)
Converts the given;@link IType}, if it's the primitive long, into theLong
type.- Specified by:
longType
in interfaceITypeHelper
- Parameters:
type
- The;@link IType} to possibly convert- Returns:
- The given type if it's not the primitive long or the;@link IType} for the class
Long
-
mapType
public IType mapType()
Retrieves the;@link IType} for;@link Map}.- Specified by:
mapType
in interfaceITypeHelper
- Returns:
- The external form of the
Map
class
-
numberType
public IType numberType()
Retrieves the;@link IType} for;@link Number}.- Specified by:
numberType
in interfaceITypeHelper
- Returns:
- The external form of the
Number
class
-
objectType
public IType objectType()
Retrieves the;@link IType} for;@link Object}.- Specified by:
objectType
in interfaceITypeHelper
- Returns:
- The external form of the
Object
class
-
objectTypeDeclaration
public ITypeDeclaration objectTypeDeclaration()
Returns the;@link Object } for the;@link IType} representing theObject
class.- Specified by:
objectTypeDeclaration
in interfaceITypeHelper
- Returns:
- The;@link Object } of the
Object
class
-
primitiveBoolean
public IType primitiveBoolean()
Retrieves the;@link IType} for the primitive boolean.- Specified by:
primitiveBoolean
in interfaceITypeHelper
- Returns:
- The external form of the primitive boolean
-
primitiveByte
public IType primitiveByte()
Retrieves the;@link IType} for the primitive byte.- Specified by:
primitiveByte
in interfaceITypeHelper
- Returns:
- The external form of the primitive byte
-
primitiveChar
public IType primitiveChar()
Retrieves the;@link IType} for the primitive char.- Specified by:
primitiveChar
in interfaceITypeHelper
- Returns:
- The external form of the primitive char
-
primitiveDouble
public IType primitiveDouble()
Retrieves the;@link IType} for the primitive double.- Specified by:
primitiveDouble
in interfaceITypeHelper
- Returns:
- The external form of the primitive double
-
primitiveFloat
public IType primitiveFloat()
Retrieves the;@link IType} for the primitive float.- Specified by:
primitiveFloat
in interfaceITypeHelper
- Returns:
- The external form of the primitive float
-
primitiveInteger
public IType primitiveInteger()
Retrieves the;@link IType} for the primitive int.- Specified by:
primitiveInteger
in interfaceITypeHelper
- Returns:
- The external form of the primitive int
-
primitiveLong
public IType primitiveLong()
Retrieves the;@link IType} for the primitive long.- Specified by:
primitiveLong
in interfaceITypeHelper
- Returns:
- The external form of the primitive long
-
primitiveShort
public IType primitiveShort()
Retrieves the;@link IType} for the primitive short.- Specified by:
primitiveShort
in interfaceITypeHelper
- Returns:
- The external form of the primitive short
-
shortType
public IType shortType()
Retrieves the;@link IType} for;@link Short}.- Specified by:
shortType
in interfaceITypeHelper
- Returns:
- The external form of the
Short
class
-
stringType
public IType stringType()
Retrieves the;@link IType} for;@link String}.- Specified by:
stringType
in interfaceITypeHelper
- Returns:
- The external form of the
String
class
-
timestampType
public IType timestampType()
Retrieves the;@link IType} for;@link Timestamp}.- Specified by:
timestampType
in interfaceITypeHelper
- Returns:
- The external form of the
Timestamp
class
-
toBooleanType
public IType toBooleanType(java.lang.Object type)
Converts the given;@link IType}, if it's the primitive boolean, into theBoolean
type.- Specified by:
toBooleanType
in interfaceITypeHelper
- Parameters:
type
- The;@link IType} to possibly convert- Returns:
- The given type if it's not the primitive boolean or the;@link IType} for the class
Boolean
-
toByteType
public IType toByteType(java.lang.Object type)
Converts the given;@link IType}, if it's the primitive byte, into theByte
type.- Specified by:
toByteType
in interfaceITypeHelper
- Parameters:
type
- The;@link IType} to possibly convert- Returns:
- The given type if it's not the primitive byte or the;@link IType} for the class
Byte
-
toDoubleType
public IType toDoubleType(java.lang.Object type)
Converts the given;@link IType}, if it's the primitive double, into theDouble
type.- Specified by:
toDoubleType
in interfaceITypeHelper
- Parameters:
type
- The;@link IType} to possibly convert- Returns:
- The given type if it's not the primitive double or the;@link IType} for the class
Double
-
toFloatType
public IType toFloatType(java.lang.Object type)
Converts the given;@link IType}, if it's the primitive float, into theFloat
type.- Specified by:
toFloatType
in interfaceITypeHelper
- Parameters:
type
- The;@link IType} to possibly convert- Returns:
- The given type if it's not the primitive float or the;@link IType} for the class
Float
-
toIntegerType
public IType toIntegerType(java.lang.Object type)
Converts the given;@link IType}, if it's the primitive int, into theInteger
type.- Specified by:
toIntegerType
in interfaceITypeHelper
- Parameters:
type
- The;@link IType} to possibly convert- Returns:
- The given type if it's not the primitive int or the;@link IType} for the class
Integer
-
toShortType
public IType toShortType(java.lang.Object type)
Converts the given;@link IType}, if it's the primitive short, into theShort
type.- Specified by:
toShortType
in interfaceITypeHelper
- Parameters:
type
- The;@link IType} to possibly convert- Returns:
- The given type if it's not the primitive short or the;@link IType} for the class
Short
-
unknownType
public IType unknownType()
Retrieves the;@link IType} that represents an unknown type.- Specified by:
unknownType
in interfaceITypeHelper
- Returns:
- The external form of an unknown type
-
unknownTypeDeclaration
public ITypeDeclaration unknownTypeDeclaration()
Returns the;@link Object } for the;@link IType} representing an unknown type.- Specified by:
unknownTypeDeclaration
in interfaceITypeHelper
- Returns:
- The;@link Object } of the unknown type
-
-