Class Type<T>

  • Type Parameters:
    T -
    All Implemented Interfaces:
    java.lang.Comparable<Type<?>>

    public final class Type<T>
    extends java.lang.Object
    implements java.lang.Comparable<Type<?>>
    Instances of this class map Java types to property types. Passing an instance of this class to PropertyState.getValue(Type) determines the return type of that method.
    • Method Detail

      • tag

        public int tag()
        Corresponding type tag as defined in PropertyType.
        Returns:
        type tag
      • isArray

        public boolean isArray()
        Determine whether this is an array type
        Returns:
        true if and only if this is an array type
      • fromTag

        public static Type<?> fromTag​(int tag,
                                      boolean array)
        Corresponding Type for a given type tag and array flag.
        Parameters:
        tag - type tag as defined in PropertyType.
        array - whether this is an array or not
        Returns:
        Type instance
        Throws:
        java.lang.IllegalArgumentException - if tag is not valid as per definition in PropertyType.
      • fromString

        public static Type<?> fromString​(java.lang.String string)
        Returns the Type with the given string representation.
        Parameters:
        string - type string
        Returns:
        matching type
      • getBaseType

        public Type<?> getBaseType()
        Determine the base type of array types
        Returns:
        base type
        Throws:
        java.lang.IllegalStateException - if isArray is false.
      • getArrayType

        public Type<?> getArrayType()
        Determine the array type which has this type as base type
        Returns:
        array type with this type as base type
        Throws:
        java.lang.IllegalStateException - if isArray is true.
      • compareTo

        public int compareTo​(@NotNull
                             @NotNull Type<?> that)
        Specified by:
        compareTo in interface java.lang.Comparable<T>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object