Class TypeHelper
java.lang.Object
org.eclipse.persistence.jpa.jpql.tools.TypeHelper
This helper contains methods related to
IType
and can perform equivalency checks.- Since:
- 2.3
- Version:
- 2.4
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves theIType
forBigDecimal
.Retrieves theIType
forBigInteger
.byteType()
Retrieves theIType
forCollection
.convertPrimitive
(IType type) Converts the givenIType
, if it's representing a primitive type, into the class of the same type.dateType()
enumType()
Returns theIType
of the given Java type.Retrieves the external class for the given fully qualified class name.Returns theITypeRepository
used by this helperboolean
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
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.longType()
Converts the givenIType
, if it's the primitive long, into theLong
type.mapType()
Retrieves theIType
for the primitive boolean.Retrieves theIType
for the primitive byte.Retrieves theIType
for the primitive char.Retrieves theIType
for the primitive double.Retrieves theIType
for the primitive float.Retrieves theIType
for the primitive int.Retrieves theIType
for the primitive long.Retrieves theIType
for the primitive short.toBooleanType
(IType type) Converts the givenIType
, if it's the primitive boolean, into theBoolean
type.toByteType
(IType type) Converts the givenIType
, if it's the primitive byte, into theByte
type.toDoubleType
(IType type) Converts the givenIType
, if it's the primitive double, into theDouble
type.toFloatType
(IType type) Converts the givenIType
, if it's the primitive float, into theFloat
type.toIntegerType
(IType type) Converts the givenIType
, if it's the primitive int, into theInteger
type.toShortType
(IType type) Converts the givenIType
, if it's the primitive short, into theShort
type.Retrieves theIType
that represents an unknown type.Returns theITypeDeclaration
for theIType
representing an unknown type.
-
Constructor Details
-
TypeHelper
Creates a newTypeHelper
.- Parameters:
typeRepository
- The repository used to retrieve the types
-
-
Method Details
-
bigDecimal
Retrieves theIType
forBigDecimal
.- Returns:
- The external form of the
BigDecimal
class
-
bigInteger
Retrieves theIType
forBigInteger
.- Returns:
- The external form of the
BigInteger
class
-
booleanType
- Returns:
- The external form of the
Boolean
class
-
byteType
- Returns:
- The external form of the
Byte
class
-
characterType
- Returns:
- The external form of the
Character
class
-
collectionType
Retrieves theIType
forCollection
.- Returns:
- The external form of the
Collection
class
-
convertPrimitive
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
- Returns:
- The external form of the
Date
class
-
doubleType
- Returns:
- The external form of the
Double
class
-
enumType
- Returns:
- The external form of the
Enum
class
-
floatType
- Returns:
- The external form of the
Float
class
-
getType
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
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
Returns theITypeRepository
used by this helper- Returns:
- The external form of the provider of
ITypes
.
-
integerType
- Returns:
- The external form of the
Integer
class
-
isBooleanType
-
isCollectionType
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
-
isEnumType
-
isFloatingType
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
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
-
isNumericType
-
isObjectType
-
isPrimitiveType
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
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
- Returns:
- The external form of the
Long
class
-
longType
Converts the givenIType
, if it's the primitive long, into theLong
type. -
mapType
- Returns:
- The external form of the
Map
class
-
numberType
- Returns:
- The external form of the
Number
class
-
objectType
- Returns:
- The external form of the
Object
class
-
objectTypeDeclaration
- Returns:
- The
ITypeDeclaration
of theObject
class
-
primitiveBoolean
Retrieves theIType
for the primitive boolean.- Returns:
- The external form of the primitive boolean
-
primitiveByte
Retrieves theIType
for the primitive byte.- Returns:
- The external form of the primitive byte
-
primitiveChar
Retrieves theIType
for the primitive char.- Returns:
- The external form of the primitive char
-
primitiveDouble
Retrieves theIType
for the primitive double.- Returns:
- The external form of the primitive double
-
primitiveFloat
Retrieves theIType
for the primitive float.- Returns:
- The external form of the primitive float
-
primitiveInteger
Retrieves theIType
for the primitive int.- Returns:
- The external form of the primitive int
-
primitiveLong
Retrieves theIType
for the primitive long.- Returns:
- The external form of the primitive long
-
primitiveShort
Retrieves theIType
for the primitive short.- Returns:
- The external form of the primitive short
-
shortType
- Returns:
- The external form of the
Short
class
-
stringType
- Returns:
- The external form of the
String
class
-
timestampType
- Returns:
- The external form of the
Timestamp
class
-
toBooleanType
Converts the givenIType
, if it's the primitive boolean, into theBoolean
type. -
toByteType
Converts the givenIType
, if it's the primitive byte, into theByte
type. -
toDoubleType
Converts the givenIType
, if it's the primitive double, into theDouble
type. -
toFloatType
Converts the givenIType
, if it's the primitive float, into theFloat
type. -
toIntegerType
Converts the givenIType
, if it's the primitive int, into theInteger
type. -
toShortType
Converts the givenIType
, if it's the primitive short, into theShort
type. -
unknownType
Retrieves theIType
that represents an unknown type.- Returns:
- The external form of an unknown type
-
unknownTypeDeclaration
Returns theITypeDeclaration
for theIType
representing an unknown type.- Returns:
- The
ITypeDeclaration
of the unknown type
-