public final class TypeHelper
extends java.lang.Object
IType and can perform equivalency checks.| Constructor and Description |
|---|
TypeHelper(ITypeRepository typeRepository)
Creates a new
TypeHelper. |
| Modifier and Type | Method and Description |
|---|---|
IType |
bigDecimal()
Retrieves the
IType for BigDecimal. |
IType |
bigInteger()
Retrieves the
IType for BigInteger. |
IType |
booleanType()
Retrieves the
IType for Boolean. |
IType |
byteType()
Retrieves the
IType for Byte. |
IType |
characterType()
Retrieves the
IType for Character. |
IType |
collectionType()
Retrieves the
IType for Collection. |
IType |
convertPrimitive(IType type)
Converts the given
IType, if it's representing a primitive type, into the class of the
same type. |
IType |
dateType()
Retrieves the
IType for Date. |
IType |
doubleType()
Retrieves the
IType for Double. |
IType |
enumType()
Retrieves the
IType for Enum. |
IType |
floatType()
Retrieves the
IType for Float. |
IType |
getType(java.lang.Class<?> type)
Returns the
IType of the given Java type. |
IType |
getType(java.lang.String typeName)
Retrieves the external class for the given fully qualified class name.
|
ITypeRepository |
getTypeRepository()
Returns the
ITypeRepository used by this helper |
IType |
integerType()
Retrieves the
IType for Integer. |
boolean |
isBooleanType(IType type)
Determines whether the given
IType is a Boolean. |
boolean |
isCollectionType(IType type)
Determines whether the given
IType is an instance of Collection. |
boolean |
isDateType(IType type)
|
boolean |
isEnumType(IType type)
Determines whether the given
IType is an instance of Enum. |
boolean |
isFloatingType(IType type)
Determines whether the given
IType is an instance of a floating type, which is either
Float, Double, float or double. |
boolean |
isIntegralType(IType type)
Determines whether the given
IType is an instance of a floating type, which is either
Integer, Long, int or float. |
boolean |
isMapType(IType type)
Determines whether the given
IType is an instance of Map. |
boolean |
isNumericType(IType type)
Determines whether the given
IType is an instance of Number. |
boolean |
isObjectType(IType type)
Determines whether the given
IType is the external form of Object. |
boolean |
isPrimitiveType(IType type)
Determines whether the given
IType represents a primitive type. |
boolean |
isStringType(IType type)
Determines whether the given
IType represents the String class. |
IType |
longType()
Retrieves the
IType for Long. |
IType |
longType(IType type)
Converts the given
IType, if it's the primitive long, into the Long type. |
IType |
mapType()
Retrieves the
IType for Map. |
IType |
numberType()
Retrieves the
IType for Number. |
IType |
objectType()
Retrieves the
IType for Object. |
ITypeDeclaration |
objectTypeDeclaration()
|
IType |
primitiveBoolean()
Retrieves the
IType for the primitive boolean. |
IType |
primitiveByte()
Retrieves the
IType for the primitive byte. |
IType |
primitiveChar()
Retrieves the
IType for the primitive char. |
IType |
primitiveDouble()
Retrieves the
IType for the primitive double. |
IType |
primitiveFloat()
Retrieves the
IType for the primitive float. |
IType |
primitiveInteger()
Retrieves the
IType for the primitive int. |
IType |
primitiveLong()
Retrieves the
IType for the primitive long. |
IType |
primitiveShort()
Retrieves the
IType for the primitive short. |
IType |
shortType()
Retrieves the
IType for Short. |
IType |
stringType()
Retrieves the
IType for String. |
IType |
timestampType()
Retrieves the
IType for Timestamp. |
IType |
toBooleanType(IType type)
Converts the given
IType, if it's the primitive boolean, into the Boolean
type. |
IType |
toByteType(IType type)
Converts the given
IType, if it's the primitive byte, into the Byte
type. |
IType |
toDoubleType(IType type)
Converts the given
IType, if it's the primitive double, into the Double
type. |
IType |
toFloatType(IType type)
Converts the given
IType, if it's the primitive float, into the Float
type. |
IType |
toIntegerType(IType type)
Converts the given
IType, if it's the primitive int, into the Integer
type. |
IType |
toShortType(IType type)
Converts the given
IType, if it's the primitive short, into the Short
type. |
IType |
unknownType()
Retrieves the
IType that represents an unknown type. |
ITypeDeclaration |
unknownTypeDeclaration()
Returns the
ITypeDeclaration for the IType representing an unknown type. |
public TypeHelper(ITypeRepository typeRepository)
TypeHelper.typeRepository - The repository used to retrieve the typespublic IType bigDecimal()
IType for BigDecimal.BigDecimal classpublic IType bigInteger()
IType for BigInteger.BigInteger classpublic IType booleanType()
IType for Boolean.Boolean classpublic IType byteType()
IType for Byte.Byte classpublic IType characterType()
IType for Character.Character classpublic IType collectionType()
IType for Collection.Collection classpublic IType convertPrimitive(IType type)
IType, if it's representing a primitive type, into the class of the
same type.type - Type to possibly convert from the primitive into the classIType if it's not a primitive type otherwise the primitive type will
have been converted into the class of that primitivepublic IType dateType()
IType for Date.Date classpublic IType doubleType()
IType for Double.Double classpublic IType enumType()
IType for Enum.Enum classpublic IType floatType()
IType for Float.Float classpublic IType getType(java.lang.Class<?> type)
IType of the given Java type.type - The Java type for which its external form will be returnedIType representing the given Java typepublic IType getType(java.lang.String typeName)
typeName - The fully qualified class name of the class to retrievepublic ITypeRepository getTypeRepository()
ITypeRepository used by this helperITypes.public IType integerType()
IType for Integer.Integer classpublic boolean isBooleanType(IType type)
IType is a Boolean.type - The type to check it's assignabilitytrue if the given IType is a Boolean; false
otherwisepublic boolean isCollectionType(IType type)
IType is an instance of Collection.type - The type to check it's assignabilitytrue if the given IType is an instance of Collection;
false otherwisepublic boolean isDateType(IType type)
type - The type to check it's assignabilitytrue if the given IType is a Date, Timestamp or
Calendarpublic boolean isEnumType(IType type)
IType is an instance of Enum.type - The type to check it's assignabilitytrue if the given IType is an instance of Enum;
false otherwisepublic boolean isFloatingType(IType type)
IType is an instance of a floating type, which is either
Float, Double, float or double.type - The type to check it's assignabilitytrue if the given IType is a floating type; false
otherwisepublic boolean isIntegralType(IType type)
IType is an instance of a floating type, which is either
Integer, Long, int or float.type - The type to check it's assignabilitytrue if the given IType is a integral type; false
otherwisepublic boolean isMapType(IType type)
IType is an instance of Map.type - The type to check it's assignabilitytrue if the given IType is an instance of Map;
false otherwisepublic boolean isNumericType(IType type)
IType is an instance of Number.type - The type to check it's assignabilitytrue if the given IType is an instance of Number;
false otherwisepublic boolean isObjectType(IType type)
IType is the external form of Object.type - The type to check it's assignabilitytrue if the given IType is the external form of Objectpublic boolean isPrimitiveType(IType type)
IType represents a primitive type.type - The type to check it's assignabilitytrue if the given IType represents a primitive; false
otherwisepublic boolean isStringType(IType type)
IType represents the String class.type - The type to check it's assignabilitytrue if the given IType represents the String class;
false otherwisepublic IType longType()
IType for Long.Long classpublic IType longType(IType type)
IType, if it's the primitive long, into the Long type.public IType mapType()
IType for Map.Map classpublic IType numberType()
IType for Number.Number classpublic IType objectType()
IType for Object.Object classpublic ITypeDeclaration objectTypeDeclaration()
ITypeDeclaration of the Object classpublic IType primitiveBoolean()
IType for the primitive boolean.public IType primitiveByte()
IType for the primitive byte.public IType primitiveChar()
IType for the primitive char.public IType primitiveDouble()
IType for the primitive double.public IType primitiveFloat()
IType for the primitive float.public IType primitiveInteger()
IType for the primitive int.public IType primitiveLong()
IType for the primitive long.public IType primitiveShort()
IType for the primitive short.public IType shortType()
IType for Short.Short classpublic IType stringType()
IType for String.String classpublic IType timestampType()
IType for Timestamp.Timestamp classpublic IType toBooleanType(IType type)
IType, if it's the primitive boolean, into the Boolean
type.public IType toByteType(IType type)
IType, if it's the primitive byte, into the Byte
type.public IType toDoubleType(IType type)
IType, if it's the primitive double, into the Double
type.public IType toFloatType(IType type)
IType, if it's the primitive float, into the Float
type.public IType toIntegerType(IType type)
IType, if it's the primitive int, into the Integer
type.public IType toShortType(IType type)
IType, if it's the primitive short, into the Short
type.public IType unknownType()
IType that represents an unknown type.public ITypeDeclaration unknownTypeDeclaration()
ITypeDeclaration for the IType representing an unknown type.ITypeDeclaration of the unknown type