Class GenericTypeHelper

  • All Implemented Interfaces:
    ITypeHelper

    public class GenericTypeHelper
    extends java.lang.Object
    implements ITypeHelper
    This generic implementation of ITypeHelper wraps ITypeHelper and delegates the calls to it.
    Version:
    2.4
    Author:
    Pascal Filion
    Since:
    2.4
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      IType bigDecimal()
      Retrieves the;@link IType} for;@link BigDecimal}.
      IType bigInteger()
      Retrieves the;@link IType} for;@link BigInteger}.
      IType booleanType()
      Retrieves the;@link IType} for;@link Boolean}.
      IType byteType()
      Retrieves the;@link IType} for;@link Byte}.
      IType characterType()
      Retrieves the;@link IType} for;@link Character}.
      IType collectionType()
      Retrieves the;@link IType} for;@link Collection}.
      IType convertPrimitive​(java.lang.Object type)
      Converts the given;@link IType}, if it's representing a primitive type, into the class of the same type.
      IType dateType()
      Retrieves the;@link IType} for;@link Date}.
      IType doubleType()
      Retrieves the;@link IType} for;@link Double}.
      IType enumType()
      Retrieves the;@link IType} for;@link Enum}.
      IType floatType()
      Retrieves the;@link IType} for;@link Float}.
      IType getType​(java.lang.Class<?> type)
      Returns the;@link IType} of the given Java type.
      IType getType​(java.lang.String typeName)
      Retrieves the external class for the given fully qualified class name.
      IType integerType()
      Retrieves the;@link IType} for;@link Integer}.
      boolean isBooleanType​(java.lang.Object type)
      Determines whether the given;@link IType} is a;@link Boolean}.
      boolean isCollectionType​(java.lang.Object type)
      Determines whether the given;@link IType} is an instance of;@link Collection}.
      boolean isDateType​(java.lang.Object type)
      Determines whether the given;@link IType} is a;@link Date},;@link Timestamp} or ;@link Calendar}.
      boolean isEnumType​(java.lang.Object type)
      Determines whether the given;@link IType} is an instance of;@link Enum}.
      boolean isFloatingType​(java.lang.Object type)
      Determines whether the given;@link IType} is an instance of a floating type, which is either Float, Double, float or double.
      boolean isIntegralType​(java.lang.Object type)
      Determines whether the given;@link IType} is an instance of a floating type, which is either Integer, Long, int or float.
      boolean isMapType​(java.lang.Object type)
      Determines whether the given;@link IType} is an instance of;@link Map}.
      boolean isNumericType​(java.lang.Object type)
      Determines whether the given;@link IType} is an instance of;@link Numeric}.
      boolean isObjectType​(java.lang.Object type)
      Determines whether the given;@link IType} is the external form of;@link Object}.
      boolean isPrimitiveType​(java.lang.Object type)
      Determines whether the given;@link IType} represents a primitive type.
      boolean isStringType​(java.lang.Object type)
      Determines whether the given;@link IType} represents the String class.
      IType longType()
      Retrieves the;@link IType} for;@link Long}.
      IType longType​(java.lang.Object type)
      Converts the given;@link IType}, if it's the primitive long, into the Long type.
      IType mapType()
      Retrieves the;@link IType} for;@link Map}.
      IType numberType()
      Retrieves the;@link IType} for;@link Number}.
      IType objectType()
      Retrieves the;@link IType} for;@link Object}.
      ITypeDeclaration objectTypeDeclaration()
      Returns the;@link Object } for the;@link IType} representing the Object class.
      IType primitiveBoolean()
      Retrieves the;@link IType} for the primitive boolean.
      IType primitiveByte()
      Retrieves the;@link IType} for the primitive byte.
      IType primitiveChar()
      Retrieves the;@link IType} for the primitive char.
      IType primitiveDouble()
      Retrieves the;@link IType} for the primitive double.
      IType primitiveFloat()
      Retrieves the;@link IType} for the primitive float.
      IType primitiveInteger()
      Retrieves the;@link IType} for the primitive int.
      IType primitiveLong()
      Retrieves the;@link IType} for the primitive long.
      IType primitiveShort()
      Retrieves the;@link IType} for the primitive short.
      IType shortType()
      Retrieves the;@link IType} for;@link Short}.
      IType stringType()
      Retrieves the;@link IType} for;@link String}.
      IType timestampType()
      Retrieves the;@link IType} for;@link Timestamp}.
      IType toBooleanType​(java.lang.Object type)
      Converts the given;@link IType}, if it's the primitive boolean, into the Boolean type.
      IType toByteType​(java.lang.Object type)
      Converts the given;@link IType}, if it's the primitive byte, into the Byte type.
      IType toDoubleType​(java.lang.Object type)
      Converts the given;@link IType}, if it's the primitive double, into the Double type.
      IType toFloatType​(java.lang.Object type)
      Converts the given;@link IType}, if it's the primitive float, into the Float type.
      IType toIntegerType​(java.lang.Object type)
      Converts the given;@link IType}, if it's the primitive int, into the Integer type.
      IType toShortType​(java.lang.Object type)
      Converts the given;@link IType}, if it's the primitive short, into the Short type.
      IType unknownType()
      Retrieves the;@link IType} that represents an unknown type.
      ITypeDeclaration unknownTypeDeclaration()
      Returns the;@link Object } for the;@link IType} representing an unknown type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GenericTypeHelper

        public GenericTypeHelper​(TypeHelper delegate)
        Creates a new GenericTypeHelper.
        Parameters:
        delegate - The TypeHelper that is wrapped by this one and all the calls are delegated to it
    • Method Detail

      • bigDecimal

        public IType bigDecimal()
        Retrieves the;@link IType} for;@link BigDecimal}.
        Specified by:
        bigDecimal in interface ITypeHelper
        Returns:
        The external form of the BigDecimal class
      • bigInteger

        public IType bigInteger()
        Retrieves the;@link IType} for;@link BigInteger}.
        Specified by:
        bigInteger in interface ITypeHelper
        Returns:
        The external form of the BigInteger class
      • booleanType

        public IType booleanType()
        Retrieves the;@link IType} for;@link Boolean}.
        Specified by:
        booleanType in interface ITypeHelper
        Returns:
        The external form of the Boolean class
      • byteType

        public IType byteType()
        Retrieves the;@link IType} for;@link Byte}.
        Specified by:
        byteType in interface ITypeHelper
        Returns:
        The external form of the Byte class
      • characterType

        public IType characterType()
        Retrieves the;@link IType} for;@link Character}.
        Specified by:
        characterType in interface ITypeHelper
        Returns:
        The external form of the Character class
      • collectionType

        public IType collectionType()
        Retrieves the;@link IType} for;@link Collection}.
        Specified by:
        collectionType in interface ITypeHelper
        Returns:
        The external form of the Collection class
      • convertPrimitive

        public IType convertPrimitive​(java.lang.Object type)
        Converts the given;@link IType}, if it's representing a primitive type, into the class of the same type.
        Specified by:
        convertPrimitive in interface ITypeHelper
        Parameters:
        type - Type to possibly convert from the primitive into the class
        Returns:
        The given;@link IType} if 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 the;@link IType} for;@link Date}.
        Specified by:
        dateType in interface ITypeHelper
        Returns:
        The external form of the Date class
      • doubleType

        public IType doubleType()
        Retrieves the;@link IType} for;@link Double}.
        Specified by:
        doubleType in interface ITypeHelper
        Returns:
        The external form of the Double class
      • enumType

        public IType enumType()
        Retrieves the;@link IType} for;@link Enum}.
        Specified by:
        enumType in interface ITypeHelper
        Returns:
        The external form of the Enum class
      • floatType

        public IType floatType()
        Retrieves the;@link IType} for;@link Float}.
        Specified by:
        floatType in interface ITypeHelper
        Returns:
        The external form of the Float class
      • getType

        public IType getType​(java.lang.Class<?> type)
        Returns the;@link IType} of the given Java type.
        Specified by:
        getType in interface ITypeHelper
        Parameters:
        type - The Java type for which its external form will be returned
        Returns:
        The;@link IType} representing the given Java type
      • getType

        public IType getType​(java.lang.String typeName)
        Retrieves the external class for the given fully qualified class name.
        Specified by:
        getType in interface ITypeHelper
        Parameters:
        typeName - The fully qualified class name of the class to retrieve
        Returns:
        The external form of the class to retrieve
      • integerType

        public IType integerType()
        Retrieves the;@link IType} for;@link Integer}.
        Specified by:
        integerType in interface ITypeHelper
        Returns:
        The external form of the Integer class
      • isBooleanType

        public boolean isBooleanType​(java.lang.Object type)
        Determines whether the given;@link IType} is a;@link Boolean}.
        Specified by:
        isBooleanType in interface ITypeHelper
        Parameters:
        type - The type to check it's assignability
        Returns:
        true if the given;@link IType} is a;@link Boolean}; false otherwise
      • isCollectionType

        public boolean isCollectionType​(java.lang.Object type)
        Determines whether the given;@link IType} is an instance of;@link Collection}.
        Specified by:
        isCollectionType in interface ITypeHelper
        Parameters:
        type - The type to check it's assignability
        Returns:
        true if the given;@link IType} is an instance of;@link Collection}; false otherwise
      • isDateType

        public boolean isDateType​(java.lang.Object type)
        Determines whether the given;@link IType} is a;@link Date},;@link Timestamp} or ;@link Calendar}.
        Specified by:
        isDateType in interface ITypeHelper
        Parameters:
        type - The type to check it's assignability
        Returns:
        true if the given;@link IType} is a;@link Date},;@link Timestamp} or ;@link Calendar}
      • isEnumType

        public boolean isEnumType​(java.lang.Object type)
        Determines whether the given;@link IType} is an instance of;@link Enum}.
        Specified by:
        isEnumType in interface ITypeHelper
        Parameters:
        type - The type to check it's assignability
        Returns:
        true if the given;@link IType} is an instance of;@link Enum}; false otherwise
      • isFloatingType

        public boolean isFloatingType​(java.lang.Object type)
        Determines whether the given;@link IType} is an instance of a floating type, which is either Float, Double, float or double.
        Specified by:
        isFloatingType in interface ITypeHelper
        Parameters:
        type - The type to check it's assignability
        Returns:
        true if the given;@link IType} is a floating type; false otherwise
      • isIntegralType

        public boolean isIntegralType​(java.lang.Object type)
        Determines whether the given;@link IType} is an instance of a floating type, which is either Integer, Long, int or float.
        Specified by:
        isIntegralType in interface ITypeHelper
        Parameters:
        type - The type to check it's assignability
        Returns:
        true if the given;@link IType} is a integral type; false otherwise
      • isMapType

        public boolean isMapType​(java.lang.Object type)
        Determines whether the given;@link IType} is an instance of;@link Map}.
        Specified by:
        isMapType in interface ITypeHelper
        Parameters:
        type - The type to check it's assignability
        Returns:
        true if the given;@link IType} is an instance of;@link Map}; false otherwise
      • isNumericType

        public boolean isNumericType​(java.lang.Object type)
        Determines whether the given;@link IType} is an instance of;@link Numeric}.
        Specified by:
        isNumericType in interface ITypeHelper
        Parameters:
        type - The type to check it's assignability
        Returns:
        true if the given;@link IType} is an instance of;@link Numeric}; false otherwise
      • isObjectType

        public boolean isObjectType​(java.lang.Object type)
        Determines whether the given;@link IType} is the external form of;@link Object}.
        Specified by:
        isObjectType in interface ITypeHelper
        Parameters:
        type - The type to check it's assignability
        Returns:
        true if the given;@link IType} is the external form of;@link Object}
      • isPrimitiveType

        public boolean isPrimitiveType​(java.lang.Object type)
        Determines whether the given;@link IType} represents a primitive type.
        Specified by:
        isPrimitiveType in interface ITypeHelper
        Parameters:
        type - The type to check it's assignability
        Returns:
        true if the given;@link IType} represents a primitive; false otherwise
      • isStringType

        public boolean isStringType​(java.lang.Object type)
        Determines whether the given;@link IType} represents the String class.
        Specified by:
        isStringType in interface ITypeHelper
        Parameters:
        type - The type to check it's assignability
        Returns:
        true if the given;@link IType} represents the String class; false otherwise
      • longType

        public IType longType()
        Retrieves the;@link IType} for;@link Long}.
        Specified by:
        longType in interface ITypeHelper
        Returns:
        The external form of the Long class
      • longType

        public IType longType​(java.lang.Object type)
        Converts the given;@link IType}, if it's the primitive long, into the Long type.
        Specified by:
        longType in interface ITypeHelper
        Parameters:
        type - The;@link IType} to possibly convert
        Returns:
        The given type if it's not the primitive long or the;@link IType} for the class Long
      • mapType

        public IType mapType()
        Retrieves the;@link IType} for;@link Map}.
        Specified by:
        mapType in interface ITypeHelper
        Returns:
        The external form of the Map class
      • numberType

        public IType numberType()
        Retrieves the;@link IType} for;@link Number}.
        Specified by:
        numberType in interface ITypeHelper
        Returns:
        The external form of the Number class
      • objectType

        public IType objectType()
        Retrieves the;@link IType} for;@link Object}.
        Specified by:
        objectType in interface ITypeHelper
        Returns:
        The external form of the Object class
      • objectTypeDeclaration

        public ITypeDeclaration objectTypeDeclaration()
        Returns the;@link Object } for the;@link IType} representing the Object class.
        Specified by:
        objectTypeDeclaration in interface ITypeHelper
        Returns:
        The;@link Object } of the Object class
      • primitiveBoolean

        public IType primitiveBoolean()
        Retrieves the;@link IType} for the primitive boolean.
        Specified by:
        primitiveBoolean in interface ITypeHelper
        Returns:
        The external form of the primitive boolean
      • primitiveByte

        public IType primitiveByte()
        Retrieves the;@link IType} for the primitive byte.
        Specified by:
        primitiveByte in interface ITypeHelper
        Returns:
        The external form of the primitive byte
      • primitiveChar

        public IType primitiveChar()
        Retrieves the;@link IType} for the primitive char.
        Specified by:
        primitiveChar in interface ITypeHelper
        Returns:
        The external form of the primitive char
      • primitiveDouble

        public IType primitiveDouble()
        Retrieves the;@link IType} for the primitive double.
        Specified by:
        primitiveDouble in interface ITypeHelper
        Returns:
        The external form of the primitive double
      • primitiveFloat

        public IType primitiveFloat()
        Retrieves the;@link IType} for the primitive float.
        Specified by:
        primitiveFloat in interface ITypeHelper
        Returns:
        The external form of the primitive float
      • primitiveInteger

        public IType primitiveInteger()
        Retrieves the;@link IType} for the primitive int.
        Specified by:
        primitiveInteger in interface ITypeHelper
        Returns:
        The external form of the primitive int
      • primitiveLong

        public IType primitiveLong()
        Retrieves the;@link IType} for the primitive long.
        Specified by:
        primitiveLong in interface ITypeHelper
        Returns:
        The external form of the primitive long
      • primitiveShort

        public IType primitiveShort()
        Retrieves the;@link IType} for the primitive short.
        Specified by:
        primitiveShort in interface ITypeHelper
        Returns:
        The external form of the primitive short
      • shortType

        public IType shortType()
        Retrieves the;@link IType} for;@link Short}.
        Specified by:
        shortType in interface ITypeHelper
        Returns:
        The external form of the Short class
      • stringType

        public IType stringType()
        Retrieves the;@link IType} for;@link String}.
        Specified by:
        stringType in interface ITypeHelper
        Returns:
        The external form of the String class
      • timestampType

        public IType timestampType()
        Retrieves the;@link IType} for;@link Timestamp}.
        Specified by:
        timestampType in interface ITypeHelper
        Returns:
        The external form of the Timestamp class
      • toBooleanType

        public IType toBooleanType​(java.lang.Object type)
        Converts the given;@link IType}, if it's the primitive boolean, into the Boolean type.
        Specified by:
        toBooleanType in interface ITypeHelper
        Parameters:
        type - The;@link IType} to possibly convert
        Returns:
        The given type if it's not the primitive boolean or the;@link IType} for the class Boolean
      • toByteType

        public IType toByteType​(java.lang.Object type)
        Converts the given;@link IType}, if it's the primitive byte, into the Byte type.
        Specified by:
        toByteType in interface ITypeHelper
        Parameters:
        type - The;@link IType} to possibly convert
        Returns:
        The given type if it's not the primitive byte or the;@link IType} for the class Byte
      • toDoubleType

        public IType toDoubleType​(java.lang.Object type)
        Converts the given;@link IType}, if it's the primitive double, into the Double type.
        Specified by:
        toDoubleType in interface ITypeHelper
        Parameters:
        type - The;@link IType} to possibly convert
        Returns:
        The given type if it's not the primitive double or the;@link IType} for the class Double
      • toFloatType

        public IType toFloatType​(java.lang.Object type)
        Converts the given;@link IType}, if it's the primitive float, into the Float type.
        Specified by:
        toFloatType in interface ITypeHelper
        Parameters:
        type - The;@link IType} to possibly convert
        Returns:
        The given type if it's not the primitive float or the;@link IType} for the class Float
      • toIntegerType

        public IType toIntegerType​(java.lang.Object type)
        Converts the given;@link IType}, if it's the primitive int, into the Integer type.
        Specified by:
        toIntegerType in interface ITypeHelper
        Parameters:
        type - The;@link IType} to possibly convert
        Returns:
        The given type if it's not the primitive int or the;@link IType} for the class Integer
      • toShortType

        public IType toShortType​(java.lang.Object type)
        Converts the given;@link IType}, if it's the primitive short, into the Short type.
        Specified by:
        toShortType in interface ITypeHelper
        Parameters:
        type - The;@link IType} to possibly convert
        Returns:
        The given type if it's not the primitive short or the;@link IType} for the class Short
      • unknownType

        public IType unknownType()
        Retrieves the;@link IType} that represents an unknown type.
        Specified by:
        unknownType in interface ITypeHelper
        Returns:
        The external form of an unknown type
      • unknownTypeDeclaration

        public ITypeDeclaration unknownTypeDeclaration()
        Returns the;@link Object } for the;@link IType} representing an unknown type.
        Specified by:
        unknownTypeDeclaration in interface ITypeHelper
        Returns:
        The;@link Object } of the unknown type