Class TypeHelper
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.TypeHelper
-
public final class TypeHelper extends java.lang.ObjectThis helper contains methods related toITypeand can perform equivalency checks.- Version:
- 2.4
- Author:
- Pascal Filion
- Since:
- 2.3
-
-
Constructor Summary
Constructors Constructor Description TypeHelper(ITypeRepository typeRepository)Creates a newTypeHelper.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ITypebigDecimal()Retrieves theITypeforBigDecimal.ITypebigInteger()Retrieves theITypeforBigInteger.ITypebooleanType()Retrieves theITypeforBoolean.ITypebyteType()Retrieves theITypeforByte.ITypecharacterType()Retrieves theITypeforCharacter.ITypecollectionType()Retrieves theITypeforCollection.ITypeconvertPrimitive(IType type)Converts the givenIType, if it's representing a primitive type, into the class of the same type.ITypedateType()Retrieves theITypeforDate.ITypedoubleType()Retrieves theITypeforDouble.ITypeenumType()Retrieves theITypeforEnum.ITypefloatType()Retrieves theITypeforFloat.ITypegetType(java.lang.Class<?> type)Returns theITypeof the given Java type.ITypegetType(java.lang.String typeName)Retrieves the external class for the given fully qualified class name.ITypeRepositorygetTypeRepository()Returns theITypeRepositoryused by this helperITypeintegerType()Retrieves theITypeforInteger.booleanisBooleanType(IType type)Determines whether the givenITypeis aBoolean.booleanisCollectionType(IType type)Determines whether the givenITypeis an instance ofCollection.booleanisDateType(IType type)booleanisEnumType(IType type)Determines whether the givenITypeis an instance ofEnum.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.booleanisMapType(IType type)Determines whether the givenITypeis an instance ofMap.booleanisNumericType(IType type)Determines whether the givenITypeis an instance ofNumber.booleanisObjectType(IType type)Determines whether the givenITypeis the external form ofObject.booleanisPrimitiveType(IType type)Determines whether the givenITyperepresents a primitive type.booleanisStringType(IType type)Determines whether the givenITyperepresents theStringclass.ITypelongType()Retrieves theITypeforLong.ITypelongType(IType type)Converts the givenIType, if it's the primitive long, into theLongtype.ITypemapType()Retrieves theITypeforMap.ITypenumberType()Retrieves theITypeforNumber.ITypeobjectType()Retrieves theITypeforObject.ITypeDeclarationobjectTypeDeclaration()ITypeprimitiveBoolean()Retrieves theITypefor the primitive boolean.ITypeprimitiveByte()Retrieves theITypefor the primitive byte.ITypeprimitiveChar()Retrieves theITypefor the primitive char.ITypeprimitiveDouble()Retrieves theITypefor the primitive double.ITypeprimitiveFloat()Retrieves theITypefor the primitive float.ITypeprimitiveInteger()Retrieves theITypefor the primitive int.ITypeprimitiveLong()Retrieves theITypefor the primitive long.ITypeprimitiveShort()Retrieves theITypefor the primitive short.ITypeshortType()Retrieves theITypeforShort.ITypestringType()Retrieves theITypeforString.ITypetimestampType()Retrieves theITypeforTimestamp.ITypetoBooleanType(IType type)Converts the givenIType, if it's the primitive boolean, into theBooleantype.ITypetoByteType(IType type)Converts the givenIType, if it's the primitive byte, into theBytetype.ITypetoDoubleType(IType type)Converts the givenIType, if it's the primitive double, into theDoubletype.ITypetoFloatType(IType type)Converts the givenIType, if it's the primitive float, into theFloattype.ITypetoIntegerType(IType type)Converts the givenIType, if it's the primitive int, into theIntegertype.ITypetoShortType(IType type)Converts the givenIType, if it's the primitive short, into theShorttype.ITypeunknownType()Retrieves theITypethat represents an unknown type.ITypeDeclarationunknownTypeDeclaration()Returns theITypeDeclarationfor theITyperepresenting 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 theITypeforBigDecimal.- Returns:
- The external form of the
BigDecimalclass
-
bigInteger
public IType bigInteger()
Retrieves theITypeforBigInteger.- Returns:
- The external form of the
BigIntegerclass
-
booleanType
public IType booleanType()
Retrieves theITypeforBoolean.- Returns:
- The external form of the
Booleanclass
-
byteType
public IType byteType()
Retrieves theITypeforByte.- Returns:
- The external form of the
Byteclass
-
characterType
public IType characterType()
Retrieves theITypeforCharacter.- Returns:
- The external form of the
Characterclass
-
collectionType
public IType collectionType()
Retrieves theITypeforCollection.- Returns:
- The external form of the
Collectionclass
-
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
ITypeif 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 theITypeforDate.- Returns:
- The external form of the
Dateclass
-
doubleType
public IType doubleType()
Retrieves theITypeforDouble.- Returns:
- The external form of the
Doubleclass
-
enumType
public IType enumType()
Retrieves theITypeforEnum.- Returns:
- The external form of the
Enumclass
-
floatType
public IType floatType()
Retrieves theITypeforFloat.- Returns:
- The external form of the
Floatclass
-
getType
public IType getType(java.lang.Class<?> type)
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
public IType getType(java.lang.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 theITypeRepositoryused by this helper- Returns:
- The external form of the provider of
ITypes.
-
integerType
public IType integerType()
Retrieves theITypeforInteger.- Returns:
- The external form of the
Integerclass
-
isBooleanType
public boolean isBooleanType(IType type)
Determines whether the givenITypeis aBoolean.- Parameters:
type- The type to check it's assignability- Returns:
trueif the givenITypeis aBoolean;falseotherwise
-
isCollectionType
public boolean isCollectionType(IType type)
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
public boolean isDateType(IType type)
- Parameters:
type- The type to check it's assignability- Returns:
trueif the givenITypeis aDate,TimestamporCalendar
-
isEnumType
public boolean isEnumType(IType type)
Determines whether the givenITypeis an instance ofEnum.- Parameters:
type- The type to check it's assignability- Returns:
trueif the givenITypeis an instance ofEnum;falseotherwise
-
isFloatingType
public boolean isFloatingType(IType type)
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
public boolean isIntegralType(IType type)
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
public boolean isMapType(IType type)
Determines whether the givenITypeis an instance ofMap.- Parameters:
type- The type to check it's assignability- Returns:
trueif the givenITypeis an instance ofMap;falseotherwise
-
isNumericType
public boolean isNumericType(IType type)
Determines whether the givenITypeis an instance ofNumber.- Parameters:
type- The type to check it's assignability- Returns:
trueif the givenITypeis an instance ofNumber;falseotherwise
-
isObjectType
public boolean isObjectType(IType type)
Determines whether the givenITypeis the external form ofObject.- Parameters:
type- The type to check it's assignability- Returns:
trueif the givenITypeis the external form ofObject
-
isPrimitiveType
public boolean isPrimitiveType(IType type)
Determines whether the givenITyperepresents a primitive type.- Parameters:
type- The type to check it's assignability- Returns:
trueif the givenITyperepresents a primitive;falseotherwise
-
isStringType
public boolean isStringType(IType type)
Determines whether the givenITyperepresents theStringclass.- Parameters:
type- The type to check it's assignability- Returns:
trueif the givenITyperepresents theStringclass;falseotherwise
-
longType
public IType longType()
Retrieves theITypeforLong.- Returns:
- The external form of the
Longclass
-
longType
public IType longType(IType type)
Converts the givenIType, if it's the primitive long, into theLongtype.
-
mapType
public IType mapType()
Retrieves theITypeforMap.- Returns:
- The external form of the
Mapclass
-
numberType
public IType numberType()
Retrieves theITypeforNumber.- Returns:
- The external form of the
Numberclass
-
objectType
public IType objectType()
Retrieves theITypeforObject.- Returns:
- The external form of the
Objectclass
-
objectTypeDeclaration
public ITypeDeclaration objectTypeDeclaration()
- Returns:
- The
ITypeDeclarationof theObjectclass
-
primitiveBoolean
public IType primitiveBoolean()
Retrieves theITypefor the primitive boolean.- Returns:
- The external form of the primitive boolean
-
primitiveByte
public IType primitiveByte()
Retrieves theITypefor the primitive byte.- Returns:
- The external form of the primitive byte
-
primitiveChar
public IType primitiveChar()
Retrieves theITypefor the primitive char.- Returns:
- The external form of the primitive char
-
primitiveDouble
public IType primitiveDouble()
Retrieves theITypefor the primitive double.- Returns:
- The external form of the primitive double
-
primitiveFloat
public IType primitiveFloat()
Retrieves theITypefor the primitive float.- Returns:
- The external form of the primitive float
-
primitiveInteger
public IType primitiveInteger()
Retrieves theITypefor the primitive int.- Returns:
- The external form of the primitive int
-
primitiveLong
public IType primitiveLong()
Retrieves theITypefor the primitive long.- Returns:
- The external form of the primitive long
-
primitiveShort
public IType primitiveShort()
Retrieves theITypefor the primitive short.- Returns:
- The external form of the primitive short
-
shortType
public IType shortType()
Retrieves theITypeforShort.- Returns:
- The external form of the
Shortclass
-
stringType
public IType stringType()
Retrieves theITypeforString.- Returns:
- The external form of the
Stringclass
-
timestampType
public IType timestampType()
Retrieves theITypeforTimestamp.- Returns:
- The external form of the
Timestampclass
-
toBooleanType
public IType toBooleanType(IType type)
Converts the givenIType, if it's the primitive boolean, into theBooleantype.
-
toByteType
public IType toByteType(IType type)
Converts the givenIType, if it's the primitive byte, into theBytetype.
-
toDoubleType
public IType toDoubleType(IType type)
Converts the givenIType, if it's the primitive double, into theDoubletype.
-
toFloatType
public IType toFloatType(IType type)
Converts the givenIType, if it's the primitive float, into theFloattype.
-
toIntegerType
public IType toIntegerType(IType type)
Converts the givenIType, if it's the primitive int, into theIntegertype.
-
toShortType
public IType toShortType(IType type)
Converts the givenIType, if it's the primitive short, into theShorttype.
-
unknownType
public IType unknownType()
Retrieves theITypethat represents an unknown type.- Returns:
- The external form of an unknown type
-
unknownTypeDeclaration
public ITypeDeclaration unknownTypeDeclaration()
Returns theITypeDeclarationfor theITyperepresenting an unknown type.- Returns:
- The
ITypeDeclarationof the unknown type
-
-