Class TypeHelper
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.TypeHelper
-
-
Constructor Summary
Constructors Constructor Description TypeHelper(ITypeRepository typeRepository)
Creates a newTypeHelper
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IType
bigDecimal()
Retrieves theIType
forBigDecimal
.IType
bigInteger()
Retrieves theIType
forBigInteger
.IType
booleanType()
IType
byteType()
IType
characterType()
IType
collectionType()
Retrieves theIType
forCollection
.IType
convertPrimitive(IType type)
Converts the givenIType
, if it's representing a primitive type, into the class of the same type.IType
dateType()
IType
doubleType()
IType
enumType()
IType
floatType()
IType
getType(Class<?> type)
Returns theIType
of the given Java type.IType
getType(String typeName)
Retrieves the external class for the given fully qualified class name.ITypeRepository
getTypeRepository()
Returns theITypeRepository
used by this helperIType
integerType()
boolean
isBooleanType(IType type)
boolean
isCollectionType(IType type)
Determines whether the givenIType
is an instance ofCollection
.boolean
isDateType(IType type)
boolean
isEnumType(IType type)
boolean
isFloatingType(IType type)
Determines whether the givenIType
is an instance of a floating type, which is eitherFloat
,Double
, float or double.boolean
isIntegralType(IType type)
Determines whether the givenIType
is an instance of a floating type, which is eitherInteger
,Long
, int or float.boolean
isMapType(IType type)
boolean
isNumericType(IType type)
boolean
isObjectType(IType type)
boolean
isPrimitiveType(IType type)
Determines whether the givenIType
represents a primitive type.boolean
isStringType(IType type)
Determines whether the givenIType
represents theString
class.IType
longType()
IType
longType(IType type)
Converts the givenIType
, if it's the primitive long, into theLong
type.IType
mapType()
IType
numberType()
IType
objectType()
ITypeDeclaration
objectTypeDeclaration()
IType
primitiveBoolean()
Retrieves theIType
for the primitive boolean.IType
primitiveByte()
Retrieves theIType
for the primitive byte.IType
primitiveChar()
Retrieves theIType
for the primitive char.IType
primitiveDouble()
Retrieves theIType
for the primitive double.IType
primitiveFloat()
Retrieves theIType
for the primitive float.IType
primitiveInteger()
Retrieves theIType
for the primitive int.IType
primitiveLong()
Retrieves theIType
for the primitive long.IType
primitiveShort()
Retrieves theIType
for the primitive short.IType
shortType()
IType
stringType()
IType
timestampType()
IType
toBooleanType(IType type)
Converts the givenIType
, if it's the primitive boolean, into theBoolean
type.IType
toByteType(IType type)
Converts the givenIType
, if it's the primitive byte, into theByte
type.IType
toDoubleType(IType type)
Converts the givenIType
, if it's the primitive double, into theDouble
type.IType
toFloatType(IType type)
Converts the givenIType
, if it's the primitive float, into theFloat
type.IType
toIntegerType(IType type)
Converts the givenIType
, if it's the primitive int, into theInteger
type.IType
toShortType(IType type)
Converts the givenIType
, if it's the primitive short, into theShort
type.IType
unknownType()
Retrieves theIType
that represents an unknown type.ITypeDeclaration
unknownTypeDeclaration()
Returns theITypeDeclaration
for theIType
representing an unknown type.
-
-
-
Constructor Detail
-
TypeHelper
public TypeHelper(ITypeRepository typeRepository)
Creates a newTypeHelper
.- Parameters:
typeRepository
- The repository used to retrieve the types
-
-
Method Detail
-
bigDecimal
public IType bigDecimal()
Retrieves theIType
forBigDecimal
.- Returns:
- The external form of the
BigDecimal
class
-
bigInteger
public IType bigInteger()
Retrieves theIType
forBigInteger
.- Returns:
- The external form of the
BigInteger
class
-
booleanType
public IType booleanType()
- Returns:
- The external form of the
Boolean
class
-
byteType
public IType byteType()
- Returns:
- The external form of the
Byte
class
-
characterType
public IType characterType()
- Returns:
- The external form of the
Character
class
-
collectionType
public IType collectionType()
Retrieves theIType
forCollection
.- Returns:
- The external form of the
Collection
class
-
convertPrimitive
public IType convertPrimitive(IType type)
Converts the givenIType
, if it's representing a primitive type, into the class of the same type.- Parameters:
type
- Type to possibly convert from the primitive into the class- Returns:
- The given
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()
- Returns:
- The external form of the
Date
class
-
doubleType
public IType doubleType()
- Returns:
- The external form of the
Double
class
-
enumType
public IType enumType()
- Returns:
- The external form of the
Enum
class
-
floatType
public IType floatType()
- Returns:
- The external form of the
Float
class
-
getType
public IType getType(Class<?> type)
Returns theIType
of the given Java type.- Parameters:
type
- The Java type for which its external form will be returned- Returns:
- The
IType
representing the given Java type
-
getType
public IType getType(String typeName)
Retrieves the external class for the given fully qualified class name.- Parameters:
typeName
- The fully qualified class name of the class to retrieve- Returns:
- The external form of the class to retrieve
-
getTypeRepository
public ITypeRepository getTypeRepository()
Returns theITypeRepository
used by this helper- Returns:
- The external form of the provider of
ITypes
.
-
integerType
public IType integerType()
- Returns:
- The external form of the
Integer
class
-
isBooleanType
public boolean isBooleanType(IType type)
-
isCollectionType
public boolean isCollectionType(IType type)
Determines whether the givenIType
is an instance ofCollection
.- Parameters:
type
- The type to check it's assignability- Returns:
true
if the givenIType
is an instance ofCollection
;false
otherwise
-
isDateType
public boolean isDateType(IType type)
-
isEnumType
public boolean isEnumType(IType type)
-
isFloatingType
public boolean isFloatingType(IType type)
Determines whether the givenIType
is an instance of a floating type, which is eitherFloat
,Double
, float or double.- Parameters:
type
- The type to check it's assignability- Returns:
true
if the givenIType
is a floating type;false
otherwise
-
isIntegralType
public boolean isIntegralType(IType type)
Determines whether the givenIType
is an instance of a floating type, which is eitherInteger
,Long
, int or float.- Parameters:
type
- The type to check it's assignability- Returns:
true
if the givenIType
is a integral type;false
otherwise
-
isMapType
public boolean isMapType(IType type)
-
isNumericType
public boolean isNumericType(IType type)
-
isObjectType
public boolean isObjectType(IType type)
-
isPrimitiveType
public boolean isPrimitiveType(IType type)
Determines whether the givenIType
represents a primitive type.- Parameters:
type
- The type to check it's assignability- Returns:
true
if the givenIType
represents a primitive;false
otherwise
-
isStringType
public boolean isStringType(IType type)
Determines whether the givenIType
represents theString
class.- Parameters:
type
- The type to check it's assignability- Returns:
true
if the givenIType
represents theString
class;false
otherwise
-
longType
public IType longType()
- Returns:
- The external form of the
Long
class
-
longType
public IType longType(IType type)
Converts the givenIType
, if it's the primitive long, into theLong
type.
-
mapType
public IType mapType()
- Returns:
- The external form of the
Map
class
-
numberType
public IType numberType()
- Returns:
- The external form of the
Number
class
-
objectType
public IType objectType()
- Returns:
- The external form of the
Object
class
-
objectTypeDeclaration
public ITypeDeclaration objectTypeDeclaration()
- Returns:
- The
ITypeDeclaration
of theObject
class
-
primitiveBoolean
public IType primitiveBoolean()
Retrieves theIType
for the primitive boolean.- Returns:
- The external form of the primitive boolean
-
primitiveByte
public IType primitiveByte()
Retrieves theIType
for the primitive byte.- Returns:
- The external form of the primitive byte
-
primitiveChar
public IType primitiveChar()
Retrieves theIType
for the primitive char.- Returns:
- The external form of the primitive char
-
primitiveDouble
public IType primitiveDouble()
Retrieves theIType
for the primitive double.- Returns:
- The external form of the primitive double
-
primitiveFloat
public IType primitiveFloat()
Retrieves theIType
for the primitive float.- Returns:
- The external form of the primitive float
-
primitiveInteger
public IType primitiveInteger()
Retrieves theIType
for the primitive int.- Returns:
- The external form of the primitive int
-
primitiveLong
public IType primitiveLong()
Retrieves theIType
for the primitive long.- Returns:
- The external form of the primitive long
-
primitiveShort
public IType primitiveShort()
Retrieves theIType
for the primitive short.- Returns:
- The external form of the primitive short
-
shortType
public IType shortType()
- Returns:
- The external form of the
Short
class
-
stringType
public IType stringType()
- Returns:
- The external form of the
String
class
-
timestampType
public IType timestampType()
- Returns:
- The external form of the
Timestamp
class
-
toBooleanType
public IType toBooleanType(IType type)
Converts the givenIType
, if it's the primitive boolean, into theBoolean
type.
-
toByteType
public IType toByteType(IType type)
Converts the givenIType
, if it's the primitive byte, into theByte
type.
-
toDoubleType
public IType toDoubleType(IType type)
Converts the givenIType
, if it's the primitive double, into theDouble
type.
-
toFloatType
public IType toFloatType(IType type)
Converts the givenIType
, if it's the primitive float, into theFloat
type.
-
toIntegerType
public IType toIntegerType(IType type)
Converts the givenIType
, if it's the primitive int, into theInteger
type.
-
toShortType
public IType toShortType(IType type)
Converts the givenIType
, if it's the primitive short, into theShort
type.
-
unknownType
public IType unknownType()
Retrieves theIType
that represents an unknown type.- Returns:
- The external form of an unknown type
-
unknownTypeDeclaration
public ITypeDeclaration unknownTypeDeclaration()
Returns theITypeDeclaration
for theIType
representing an unknown type.- Returns:
- The
ITypeDeclaration
of the unknown type
-
-