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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves theITypeforBigDecimal.Retrieves theITypeforBigInteger.byteType()Retrieves theITypeforCollection.convertPrimitive(IType type) Converts the givenIType, if it's representing a primitive type, into the class of the same type.dateType()enumType()Returns theITypeof the given Java type.Retrieves the external class for the given fully qualified class name.Returns theITypeRepositoryused by this helperbooleanisBooleanType(IType type) booleanisCollectionType(IType type) Determines whether the givenITypeis an instance ofCollection.booleanisDateType(IType type) booleanisEnumType(IType type) booleanisFloatingType(IType type) Determines whether the givenITypeis an instance of a floating type, which is eitherFloat,Double, float or double.booleanisIntegralType(IType type) Determines whether the givenITypeis an instance of a floating type, which is eitherInteger,Long, int or float.booleanbooleanisNumericType(IType type) booleanisObjectType(IType type) booleanisPrimitiveType(IType type) Determines whether the givenITyperepresents a primitive type.booleanisStringType(IType type) Determines whether the givenITyperepresents theStringclass.longType()Converts the givenIType, if it's the primitive long, into theLongtype.mapType()Retrieves theITypefor the primitive boolean.Retrieves theITypefor the primitive byte.Retrieves theITypefor the primitive char.Retrieves theITypefor the primitive double.Retrieves theITypefor the primitive float.Retrieves theITypefor the primitive int.Retrieves theITypefor the primitive long.Retrieves theITypefor the primitive short.toBooleanType(IType type) Converts the givenIType, if it's the primitive boolean, into theBooleantype.toByteType(IType type) Converts the givenIType, if it's the primitive byte, into theBytetype.toDoubleType(IType type) Converts the givenIType, if it's the primitive double, into theDoubletype.toFloatType(IType type) Converts the givenIType, if it's the primitive float, into theFloattype.toIntegerType(IType type) Converts the givenIType, if it's the primitive int, into theIntegertype.toShortType(IType type) Converts the givenIType, if it's the primitive short, into theShorttype.Retrieves theITypethat represents an unknown type.Returns theITypeDeclarationfor theITyperepresenting an unknown type.
-
Constructor Details
-
TypeHelper
Creates a newTypeHelper.- Parameters:
typeRepository- The repository used to retrieve the types
-
-
Method Details
-
bigDecimal
Retrieves theITypeforBigDecimal.- Returns:
- The external form of the
BigDecimalclass
-
bigInteger
Retrieves theITypeforBigInteger.- Returns:
- The external form of the
BigIntegerclass
-
booleanType
- Returns:
- The external form of the
Booleanclass
-
byteType
- Returns:
- The external form of the
Byteclass
-
characterType
- Returns:
- The external form of the
Characterclass
-
collectionType
Retrieves theITypeforCollection.- Returns:
- The external form of the
Collectionclass
-
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
ITypeif 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
Dateclass
-
doubleType
- Returns:
- The external form of the
Doubleclass
-
enumType
- Returns:
- The external form of the
Enumclass
-
floatType
- Returns:
- The external form of the
Floatclass
-
getType
Returns theITypeof the given Java type.- Parameters:
type- The Java type for which its external form will be returned- Returns:
- The
ITyperepresenting 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 theITypeRepositoryused by this helper- Returns:
- The external form of the provider of
ITypes.
-
integerType
- Returns:
- The external form of the
Integerclass
-
isBooleanType
-
isCollectionType
Determines whether the givenITypeis an instance ofCollection.- Parameters:
type- The type to check it's assignability- Returns:
trueif the givenITypeis an instance ofCollection;falseotherwise
-
isDateType
-
isEnumType
-
isFloatingType
Determines whether the givenITypeis an instance of a floating type, which is eitherFloat,Double, float or double.- Parameters:
type- The type to check it's assignability- Returns:
trueif the givenITypeis a floating type;falseotherwise
-
isIntegralType
Determines whether the givenITypeis an instance of a floating type, which is eitherInteger,Long, int or float.- Parameters:
type- The type to check it's assignability- Returns:
trueif the givenITypeis a integral type;falseotherwise
-
isMapType
-
isNumericType
-
isObjectType
-
isPrimitiveType
Determines whether the givenITyperepresents a primitive type.- Parameters:
type- The type to check it's assignability- Returns:
trueif the givenITyperepresents a primitive;falseotherwise
-
isStringType
Determines whether the givenITyperepresents theStringclass.- Parameters:
type- The type to check it's assignability- Returns:
trueif the givenITyperepresents theStringclass;falseotherwise
-
longType
- Returns:
- The external form of the
Longclass
-
longType
Converts the givenIType, if it's the primitive long, into theLongtype. -
mapType
- Returns:
- The external form of the
Mapclass
-
numberType
- Returns:
- The external form of the
Numberclass
-
objectType
- Returns:
- The external form of the
Objectclass
-
objectTypeDeclaration
- Returns:
- The
ITypeDeclarationof theObjectclass
-
primitiveBoolean
Retrieves theITypefor the primitive boolean.- Returns:
- The external form of the primitive boolean
-
primitiveByte
Retrieves theITypefor the primitive byte.- Returns:
- The external form of the primitive byte
-
primitiveChar
Retrieves theITypefor the primitive char.- Returns:
- The external form of the primitive char
-
primitiveDouble
Retrieves theITypefor the primitive double.- Returns:
- The external form of the primitive double
-
primitiveFloat
Retrieves theITypefor the primitive float.- Returns:
- The external form of the primitive float
-
primitiveInteger
Retrieves theITypefor the primitive int.- Returns:
- The external form of the primitive int
-
primitiveLong
Retrieves theITypefor the primitive long.- Returns:
- The external form of the primitive long
-
primitiveShort
Retrieves theITypefor the primitive short.- Returns:
- The external form of the primitive short
-
shortType
- Returns:
- The external form of the
Shortclass
-
stringType
- Returns:
- The external form of the
Stringclass
-
timestampType
- Returns:
- The external form of the
Timestampclass
-
toBooleanType
Converts the givenIType, if it's the primitive boolean, into theBooleantype. -
toByteType
Converts the givenIType, if it's the primitive byte, into theBytetype. -
toDoubleType
Converts the givenIType, if it's the primitive double, into theDoubletype. -
toFloatType
Converts the givenIType, if it's the primitive float, into theFloattype. -
toIntegerType
Converts the givenIType, if it's the primitive int, into theIntegertype. -
toShortType
Converts the givenIType, if it's the primitive short, into theShorttype. -
unknownType
Retrieves theITypethat represents an unknown type.- Returns:
- The external form of an unknown type
-
unknownTypeDeclaration
Returns theITypeDeclarationfor theITyperepresenting an unknown type.- Returns:
- The
ITypeDeclarationof the unknown type
-