Top Description Fields Constructors Methods
org.eclipse.persistence.jpa.jpql.tools

public final Class TypeHelper

extends Object
Class Inheritance
Imports
java.math.BigDecimal, .BigInteger, java.sql.Timestamp, java.util.Calendar, .Collection, .Date, .Map, org.eclipse.persistence.jpa.jpql.tools.spi.IType, .ITypeDeclaration, .ITypeRepository

This helper contains methods related to IType and can perform equivalency checks.
Author
Pascal Filion
Since
2.3
Version
2.4

Field Summary

Modifier and TypeField and Description
private IType
objectType

The IType for the Object class.

private IType
stringType

The IType for the String class.

private final ITypeRepository
typeRepository

The external form of the provider of ITypes.

private IType
unknownType

The IType representing an unknown type.

Constructor Summary

AccessConstructor and Description
public
TypeHelper(ITypeRepository
The repository used to retrieve the types
typeRepository
)

Creates a new TypeHelper.

Method Summary

Modifier and TypeMethod and Description
public IType

Returns:

The external form of the BigDecimal class
bigDecimal
()

Retrieves the IType for BigDecimal.

public IType

Returns:

The external form of the BigInteger class
bigInteger
()

Retrieves the IType for BigInteger.

public IType

Returns:

The external form of the Boolean class
booleanType
()

Retrieves the IType for Boolean.

public IType

Returns:

The external form of the Byte class
byteType
()

Retrieves the IType for Byte.

public IType

Returns:

The external form of the Character class
characterType
()

Retrieves the IType for Character.

public IType

Returns:

The external form of the Collection class
collectionType
()

Retrieves the IType for Collection.

public IType

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
convertPrimitive
(IType
Type to possibly convert from the primitive into the class
type
)

Converts the given IType, if it's representing a primitive type, into the class of the same type.

public IType

Returns:

The external form of the Date class
dateType
()

Retrieves the IType for Date.

public IType

Returns:

The external form of the Double class
doubleType
()

Retrieves the IType for Double.

public IType

Returns:

The external form of the Enum class
enumType
()

Retrieves the IType for Enum.

public IType

Returns:

The external form of the Float class
floatType
()

Retrieves the IType for Float.

public IType

Returns:

The IType representing the given Java type
getType
(Class<?>
The Java type for which its external form will be returned
type
)

Returns the IType of the given Java type.

public IType

Returns:

The external form of the class to retrieve
getType
(String
The fully qualified class name of the class to retrieve
typeName
)

Retrieves the external class for the given fully qualified class name.

public ITypeRepository

Returns:

The external form of the provider of ITypes.
getTypeRepository
()

Returns the ITypeRepository used by this helper

public IType

Returns:

The external form of the Integer class
integerType
()

Retrieves the IType for Integer.

public boolean

Returns:

true if the given IType is a Boolean; false otherwise
isBooleanType
(IType
The type to check it's assignability
type
)

Determines whether the given IType is a Boolean.

public boolean

Returns:

true if the given IType is an instance of Collection; false otherwise
isCollectionType
(IType
The type to check it's assignability
type
)

Determines whether the given IType is an instance of Collection.

public boolean

Returns:

true if the given IType is a Date, Timestamp or Calendar
isDateType
(IType
The type to check it's assignability
type
)

Determines whether the given IType is a Date, Timestamp or Calendar.

public boolean

Returns:

true if the given IType is an instance of Enum; false otherwise
isEnumType
(IType
The type to check it's assignability
type
)

Determines whether the given IType is an instance of Enum.

public boolean

Returns:

true if the given IType is a floating type; false otherwise
isFloatingType
(IType
The type to check it's assignability
type
)

Determines whether the given IType is an instance of a floating type, which is either Float, Double, float or double.

public boolean

Returns:

true if the given IType is a integral type; false otherwise
isIntegralType
(IType
The type to check it's assignability
type
)

Determines whether the given IType is an instance of a floating type, which is either Integer, Long, int or float.

public boolean

Returns:

true if the given IType is an instance of Map; false otherwise
isMapType
(IType
The type to check it's assignability
type
)

Determines whether the given IType is an instance of Map.

public boolean

Returns:

true if the given IType is an instance of Number; false otherwise
isNumericType
(IType
The type to check it's assignability
type
)

Determines whether the given IType is an instance of Number.

public boolean

Returns:

true if the given IType is the external form of Object
isObjectType
(IType
The type to check it's assignability
type
)

Determines whether the given IType is the external form of Object.

public boolean

Returns:

true if the given IType represents a primitive; false otherwise
isPrimitiveType
(IType
The type to check it's assignability
type
)

Determines whether the given IType represents a primitive type.

public boolean

Returns:

true if the given IType represents the String class; false otherwise
isStringType
(IType
The type to check it's assignability
type
)

Determines whether the given IType represents the String class.

public IType

Returns:

The external form of the Long class
longType
()

Retrieves the IType for Long.

public IType

Returns:

The given type if it's not the primitive long or the IType for the class Long
longType
(IType
The IType to possibly convert
type
)

Converts the given IType, if it's the primitive long, into the Long type.

public IType

Returns:

The external form of the Map class
mapType
()

Retrieves the IType for Map.

public IType

Returns:

The external form of the Number class
numberType
()

Retrieves the IType for Number.

public IType

Returns:

The external form of the Object class
objectType
()

Retrieves the IType for Object.

public ITypeDeclaration

Returns:

The ITypeDeclaration of the Object class
objectTypeDeclaration
()

Returns the ITypeDeclaration for the IType representing the Object class.

public IType

Returns:

The external form of the primitive boolean
primitiveBoolean
()

Retrieves the IType for the primitive boolean.

public IType

Returns:

The external form of the primitive byte
primitiveByte
()

Retrieves the IType for the primitive byte.

public IType

Returns:

The external form of the primitive char
primitiveChar
()

Retrieves the IType for the primitive char.

public IType

Returns:

The external form of the primitive double
primitiveDouble
()

Retrieves the IType for the primitive double.

public IType

Returns:

The external form of the primitive float
primitiveFloat
()

Retrieves the IType for the primitive float.

public IType

Returns:

The external form of the primitive int
primitiveInteger
()

Retrieves the IType for the primitive int.

public IType

Returns:

The external form of the primitive long
primitiveLong
()

Retrieves the IType for the primitive long.

public IType

Returns:

The external form of the primitive short
primitiveShort
()

Retrieves the IType for the primitive short.

public IType

Returns:

The external form of the Short class
shortType
()

Retrieves the IType for Short.

public IType

Returns:

The external form of the String class
stringType
()

Retrieves the IType for String.

public IType

Returns:

The external form of the Timestamp class
timestampType
()

Retrieves the IType for Timestamp.

public IType

Returns:

The given type if it's not the primitive boolean or the IType for the class Boolean
toBooleanType
(IType
The IType to possibly convert
type
)

Converts the given IType, if it's the primitive boolean, into the Boolean type.

public IType

Returns:

The given type if it's not the primitive byte or the IType for the class Byte
toByteType
(IType
The IType to possibly convert
type
)

Converts the given IType, if it's the primitive byte, into the Byte type.

public IType

Returns:

The given type if it's not the primitive double or the IType for the class Double
toDoubleType
(IType
The IType to possibly convert
type
)

Converts the given IType, if it's the primitive double, into the Double type.

public IType

Returns:

The given type if it's not the primitive float or the IType for the class Float
toFloatType
(IType
The IType to possibly convert
type
)

Converts the given IType, if it's the primitive float, into the Float type.

public IType

Returns:

The given type if it's not the primitive int or the IType for the class Integer
toIntegerType
(IType
The IType to possibly convert
type
)

Converts the given IType, if it's the primitive int, into the Integer type.

public IType

Returns:

The given type if it's not the primitive short or the IType for the class Short
toShortType
(IType
The IType to possibly convert
type
)

Converts the given IType, if it's the primitive short, into the Short type.

public IType

Returns:

The external form of an unknown type
unknownType
()

Retrieves the IType that represents an unknown type.

public ITypeDeclaration

Returns:

The ITypeDeclaration of the unknown type
unknownTypeDeclaration
()

Returns the ITypeDeclaration for the IType representing an unknown type.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

objectTypeback to summary
private IType objectType

The IType for the Object class.

stringTypeback to summary
private IType stringType

The IType for the String class.

typeRepositoryback to summary
private final ITypeRepository typeRepository

The external form of the provider of ITypes.

unknownTypeback to summary
private IType unknownType

The IType representing an unknown type.

Constructor Detail

TypeHelperback to summary
public TypeHelper(ITypeRepository typeRepository)

Creates a new TypeHelper.

Parameters
typeRepository:ITypeRepository

The repository used to retrieve the types

Method Detail

bigDecimalback to summary
public IType bigDecimal()

Retrieves the IType for BigDecimal.

Returns:IType

The external form of the BigDecimal class

bigIntegerback to summary
public IType bigInteger()

Retrieves the IType for BigInteger.

Returns:IType

The external form of the BigInteger class

booleanTypeback to summary
public IType booleanType()

Retrieves the IType for Boolean.

Returns:IType

The external form of the Boolean class

byteTypeback to summary
public IType byteType()

Retrieves the IType for Byte.

Returns:IType

The external form of the Byte class

characterTypeback to summary
public IType characterType()

Retrieves the IType for Character.

Returns:IType

The external form of the Character class

collectionTypeback to summary
public IType collectionType()

Retrieves the IType for Collection.

Returns:IType

The external form of the Collection class

convertPrimitiveback to summary
public IType convertPrimitive(IType type)

Converts the given IType, if it's representing a primitive type, into the class of the same type.

Parameters
type:IType

Type to possibly convert from the primitive into the class

Returns:IType

The given IType if it's not a primitive type otherwise the primitive type will have been converted into the class of that primitive

dateTypeback to summary
public IType dateType()

Retrieves the IType for Date.

Returns:IType

The external form of the Date class

doubleTypeback to summary
public IType doubleType()

Retrieves the IType for Double.

Returns:IType

The external form of the Double class

enumTypeback to summary
public IType enumType()

Retrieves the IType for Enum.

Returns:IType

The external form of the Enum class

floatTypeback to summary
public IType floatType()

Retrieves the IType for Float.

Returns:IType

The external form of the Float class

getTypeback to summary
public IType getType(Class<?> type)

Returns the IType of the given Java type.

Parameters
type:Class<?>

The Java type for which its external form will be returned

Returns:IType

The IType representing the given Java type

getTypeback to summary
public IType getType(String typeName)

Retrieves the external class for the given fully qualified class name.

Parameters
typeName:String

The fully qualified class name of the class to retrieve

Returns:IType

The external form of the class to retrieve

getTypeRepositoryback to summary
public ITypeRepository getTypeRepository()

Returns the ITypeRepository used by this helper

Returns:ITypeRepository

The external form of the provider of ITypes.

integerTypeback to summary
public IType integerType()

Retrieves the IType for Integer.

Returns:IType

The external form of the Integer class

isBooleanTypeback to summary
public boolean isBooleanType(IType type)

Determines whether the given IType is a Boolean.

Parameters
type:IType

The type to check it's assignability

Returns:boolean

true if the given IType is a Boolean; false otherwise

isCollectionTypeback to summary
public boolean isCollectionType(IType type)

Determines whether the given IType is an instance of Collection.

Parameters
type:IType

The type to check it's assignability

Returns:boolean

true if the given IType is an instance of Collection; false otherwise

isDateTypeback to summary
public boolean isDateType(IType type)

Determines whether the given IType is a Date, Timestamp or Calendar.

Parameters
type:IType

The type to check it's assignability

Returns:boolean

true if the given IType is a Date, Timestamp or Calendar

isEnumTypeback to summary
public boolean isEnumType(IType type)

Determines whether the given IType is an instance of Enum.

Parameters
type:IType

The type to check it's assignability

Returns:boolean

true if the given IType is an instance of Enum; false otherwise

isFloatingTypeback to summary
public boolean isFloatingType(IType type)

Determines whether the given IType is an instance of a floating type, which is either Float, Double, float or double.

Parameters
type:IType

The type to check it's assignability

Returns:boolean

true if the given IType is a floating type; false otherwise

isIntegralTypeback to summary
public boolean isIntegralType(IType type)

Determines whether the given IType is an instance of a floating type, which is either Integer, Long, int or float.

Parameters
type:IType

The type to check it's assignability

Returns:boolean

true if the given IType is a integral type; false otherwise

isMapTypeback to summary
public boolean isMapType(IType type)

Determines whether the given IType is an instance of Map.

Parameters
type:IType

The type to check it's assignability

Returns:boolean

true if the given IType is an instance of Map; false otherwise

isNumericTypeback to summary
public boolean isNumericType(IType type)

Determines whether the given IType is an instance of Number.

Parameters
type:IType

The type to check it's assignability

Returns:boolean

true if the given IType is an instance of Number; false otherwise

isObjectTypeback to summary
public boolean isObjectType(IType type)

Determines whether the given IType is the external form of Object.

Parameters
type:IType

The type to check it's assignability

Returns:boolean

true if the given IType is the external form of Object

isPrimitiveTypeback to summary
public boolean isPrimitiveType(IType type)

Determines whether the given IType represents a primitive type.

Parameters
type:IType

The type to check it's assignability

Returns:boolean

true if the given IType represents a primitive; false otherwise

isStringTypeback to summary
public boolean isStringType(IType type)

Determines whether the given IType represents the String class.

Parameters
type:IType

The type to check it's assignability

Returns:boolean

true if the given IType represents the String class; false otherwise

longTypeback to summary
public IType longType()

Retrieves the IType for Long.

Returns:IType

The external form of the Long class

longTypeback to summary
public IType longType(IType type)

Converts the given IType, if it's the primitive long, into the Long type.

Parameters
type:IType

The IType to possibly convert

Returns:IType

The given type if it's not the primitive long or the IType for the class Long

mapTypeback to summary
public IType mapType()

Retrieves the IType for Map.

Returns:IType

The external form of the Map class

numberTypeback to summary
public IType numberType()

Retrieves the IType for Number.

Returns:IType

The external form of the Number class

objectTypeback to summary
public IType objectType()

Retrieves the IType for Object.

Returns:IType

The external form of the Object class

objectTypeDeclarationback to summary
public ITypeDeclaration objectTypeDeclaration()

Returns the ITypeDeclaration for the IType representing the Object class.

Returns:ITypeDeclaration

The ITypeDeclaration of the Object class

primitiveBooleanback to summary
public IType primitiveBoolean()

Retrieves the IType for the primitive boolean.

Returns:IType

The external form of the primitive boolean

primitiveByteback to summary
public IType primitiveByte()

Retrieves the IType for the primitive byte.

Returns:IType

The external form of the primitive byte

primitiveCharback to summary
public IType primitiveChar()

Retrieves the IType for the primitive char.

Returns:IType

The external form of the primitive char

primitiveDoubleback to summary
public IType primitiveDouble()

Retrieves the IType for the primitive double.

Returns:IType

The external form of the primitive double

primitiveFloatback to summary
public IType primitiveFloat()

Retrieves the IType for the primitive float.

Returns:IType

The external form of the primitive float

primitiveIntegerback to summary
public IType primitiveInteger()

Retrieves the IType for the primitive int.

Returns:IType

The external form of the primitive int

primitiveLongback to summary
public IType primitiveLong()

Retrieves the IType for the primitive long.

Returns:IType

The external form of the primitive long

primitiveShortback to summary
public IType primitiveShort()

Retrieves the IType for the primitive short.

Returns:IType

The external form of the primitive short

shortTypeback to summary
public IType shortType()

Retrieves the IType for Short.

Returns:IType

The external form of the Short class

stringTypeback to summary
public IType stringType()

Retrieves the IType for String.

Returns:IType

The external form of the String class

timestampTypeback to summary
public IType timestampType()

Retrieves the IType for Timestamp.

Returns:IType

The external form of the Timestamp class

toBooleanTypeback to summary
public IType toBooleanType(IType type)

Converts the given IType, if it's the primitive boolean, into the Boolean type.

Parameters
type:IType

The IType to possibly convert

Returns:IType

The given type if it's not the primitive boolean or the IType for the class Boolean

toByteTypeback to summary
public IType toByteType(IType type)

Converts the given IType, if it's the primitive byte, into the Byte type.

Parameters
type:IType

The IType to possibly convert

Returns:IType

The given type if it's not the primitive byte or the IType for the class Byte

toDoubleTypeback to summary
public IType toDoubleType(IType type)

Converts the given IType, if it's the primitive double, into the Double type.

Parameters
type:IType

The IType to possibly convert

Returns:IType

The given type if it's not the primitive double or the IType for the class Double

toFloatTypeback to summary
public IType toFloatType(IType type)

Converts the given IType, if it's the primitive float, into the Float type.

Parameters
type:IType

The IType to possibly convert

Returns:IType

The given type if it's not the primitive float or the IType for the class Float

toIntegerTypeback to summary
public IType toIntegerType(IType type)

Converts the given IType, if it's the primitive int, into the Integer type.

Parameters
type:IType

The IType to possibly convert

Returns:IType

The given type if it's not the primitive int or the IType for the class Integer

toShortTypeback to summary
public IType toShortType(IType type)

Converts the given IType, if it's the primitive short, into the Short type.

Parameters
type:IType

The IType to possibly convert

Returns:IType

The given type if it's not the primitive short or the IType for the class Short

unknownTypeback to summary
public IType unknownType()

Retrieves the IType that represents an unknown type.

Returns:IType

The external form of an unknown type

unknownTypeDeclarationback to summary
public ITypeDeclaration unknownTypeDeclaration()

Returns the ITypeDeclaration for the IType representing an unknown type.

Returns:ITypeDeclaration

The ITypeDeclaration of the unknown type