Class Type


  • public class Type
    extends Object
    Wrapper for class and primitive type information.
    Author:
    Uwe Finke
    • Field Detail

      • VOID

        public static final Type VOID
        Type representing void.
      • BOOLEAN

        public static final Type BOOLEAN
        Type representing boolean.
      • BYTE

        public static final Type BYTE
        Type representing byte.
      • SHORT

        public static final Type SHORT
        Type representing short.
      • INT

        public static final Type INT
        Type representing int.
      • LONG

        public static final Type LONG
        Type representing long.
      • FLOAT

        public static final Type FLOAT
        Type representing float.
      • DOUBLE

        public static final Type DOUBLE
        Type representing double.
      • CHAR

        public static final Type CHAR
        Type representing char.
      • STRING

        public static final Type STRING
        Type representing String.
      • OBJECT

        public static final Type OBJECT
        Type representing Object.
      • CLASS

        public static final Type CLASS
        Type representing Class.
    • Constructor Detail

      • Type

        public Type​(String type)
        Defines a type by name.
        Parameters:
        type - name of type
      • Type

        public Type​(String type,
                    String parameterName)
        Defines a type by name and gives it a name. This constructor may be used to name arguments which are passed to a method.
        Parameters:
        type - name of type
        parameterName - name of argument
      • Type

        public Type​(Class<?> type)
        Defines a type by its class.
        Parameters:
        type - class of type
      • Type

        public Type​(Class<?> type,
                    String parameterName)
        Defines a type by class and gives it a name. This constructor may be used to name arguments which are passed to a method.
        Parameters:
        type - class of type
        parameterName - name of argument
      • Type

        public Type​(GenClass type)
        Defines a type for a generated class.
        Parameters:
        type - generated class of type
      • Type

        public Type​(GenClass type,
                    String parameterName)
        Defines a type for a generated class and gives it a name. This constructor may be used to name arguments which are passed to a method.
        Parameters:
        type - generated class of type
        parameterName - name of argument
    • Method Detail

      • equals

        public boolean equals​(Object o)
        Tests equality to another Type instance. A type instance equals to another if both have the same descriptor.
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Returns the hash code.
        Overrides:
        hashCode in class Object
      • toString

        public String toString()
        Returns a String representation.
        Overrides:
        toString in class Object
      • getSize

        public int getSize()
        Returns the type's memory size in words. long and double have size 2, void has size 0 and all other types have size 1.
        Returns:
        size