Package tenapull.util

Class Type<T>

java.lang.Object
tenapull.util.Type<T>
Type Parameters:
T - the base class which this type represents

public final class Type<T>
extends java.lang.Object
Represents a type that may have type parameters, including any arbitrary level of nested type parameters e.g. ReadWriteLock<Map<Set<Thread>, Dao<Scan>>, List<Scan>>. This is an immutable class. To represent nested type params, pass a Type instance into the constructor of another Type instance
  • Constructor Summary

    Constructors 
    Constructor Description
    Type​(java.lang.Class<T> type)
    Instantiates a new Type for the provided class
    Type​(java.lang.Class<T> type, java.lang.Class param)
    Instantiates a new Type for the provided class, with the given class as a type param
    Type​(java.lang.Class<T> type, java.lang.Class[] params)
    Instantiates a new Type for the provided class, with an array of classes as type params
    Type​(java.lang.Class<T> type, java.lang.Class param1, java.lang.Class param2)
    Instantiates a new Type for the provided class, with two type params of the two provided classes
    Type​(java.lang.Class<T> type, java.util.List<java.lang.Class> params)
    Instantiates a new Type for the provided class with a List of classes as the type params
    Type​(java.lang.Class<T> type, java.util.List<Type> params, java.lang.Void nullDifferentiator)
    Instantiates a new Type for the provided class with a list of types as the type params
    Type​(java.lang.Class<T> type, Type param)
    Instantiates a new Type for the provided class, with the given Type as a type param
    Type​(java.lang.Class<T> type, Type[] params)
    Instantiates a new Type for the provided class, with an array of type params
    Type​(java.lang.Class<T> type, Type param1, Type param2)
    Instantiates a new Type for the provided class, with the two type params of the two provided types
  • Method Summary

    Modifier and Type Method Description
    boolean equals​(java.lang.Object o)  
    Type[] getParams()
    Gets a copy of the array of type params, or null if there are none
    java.lang.Class<T> getType()
    Gets root class this type represents
    int hashCode()  
    java.lang.String toString()  
    java.lang.String toStringBasic()
    Produces a string representation of this type (with type params if applicable) that does NOT include an indication that this represents an instance of the Type class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Type

      public Type​(java.lang.Class<T> type) throws java.lang.NullPointerException
      Instantiates a new Type for the provided class
      Parameters:
      type - the type
      Throws:
      java.lang.NullPointerException - the null pointer exception
    • Type

      public Type​(java.lang.Class<T> type, java.lang.Class param) throws java.lang.NullPointerException
      Instantiates a new Type for the provided class, with the given class as a type param
      Parameters:
      type - the type
      param - the param
      Throws:
      java.lang.NullPointerException - the null pointer exception
    • Type

      public Type​(java.lang.Class<T> type, Type param) throws java.lang.NullPointerException
      Instantiates a new Type for the provided class, with the given Type as a type param
      Parameters:
      type - the type
      param - the param
      Throws:
      java.lang.NullPointerException - the null pointer exception
    • Type

      public Type​(java.lang.Class<T> type, java.lang.Class param1, java.lang.Class param2)
      Instantiates a new Type for the provided class, with two type params of the two provided classes
      Parameters:
      type - the type
      param1 - the param 1
      param2 - the param 2
    • Type

      public Type​(java.lang.Class<T> type, Type param1, Type param2)
      Instantiates a new Type for the provided class, with the two type params of the two provided types
      Parameters:
      type - the type
      param1 - the param 1
      param2 - the param 2
    • Type

      public Type​(java.lang.Class<T> type, Type[] params) throws java.lang.NullPointerException
      Instantiates a new Type for the provided class, with an array of type params
      Parameters:
      type - the type
      params - the params
      Throws:
      java.lang.NullPointerException - the null pointer exception
    • Type

      public Type​(java.lang.Class<T> type, java.lang.Class[] params) throws java.lang.NullPointerException
      Instantiates a new Type for the provided class, with an array of classes as type params
      Parameters:
      type - the type
      params - the params
      Throws:
      java.lang.NullPointerException - the null pointer exception
    • Type

      public Type​(java.lang.Class<T> type, @Nullable java.util.List<java.lang.Class> params) throws java.lang.NullPointerException
      Instantiates a new Type for the provided class with a List of classes as the type params
      Parameters:
      type - the type
      params - the params
      Throws:
      java.lang.NullPointerException - the null pointer exception
    • Type

      public Type​(java.lang.Class<T> type, java.util.List<Type> params, java.lang.Void nullDifferentiator) throws java.lang.NullPointerException
      Instantiates a new Type for the provided class with a list of types as the type params
      Parameters:
      type - the type
      params - the params
      nullDifferentiator - the null differentiator
      Throws:
      java.lang.NullPointerException - the null pointer exception
  • Method Details

    • getType

      public java.lang.Class<T> getType()
      Gets root class this type represents
      Returns:
      the type
    • getParams

      public Type[] getParams()
      Gets a copy of the array of type params, or null if there are none
      Returns:
      the type [ ]
    • hashCode

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

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • toString

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

      public java.lang.String toStringBasic()
      Produces a string representation of this type (with type params if applicable) that does NOT include an indication that this represents an instance of the Type class. Used mainly by recursive calls within Type, and also by KeyValueType
      Returns:
      the string