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 classType(java.lang.Class<T> type, java.lang.Class param)
Instantiates a new Type for the provided class, with the given class as a type paramType(java.lang.Class<T> type, java.lang.Class[] params)
Instantiates a new Type for the provided class, with an array of classes as type paramsType(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 classesType(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 paramsType(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 paramsType(java.lang.Class<T> type, Type param)
Instantiates a new Type for the provided class, with the given Type as a type paramType(java.lang.Class<T> type, Type[] params)
Instantiates a new Type for the provided class, with an array of type paramsType(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 nonejava.lang.Class<T>
getType()
Gets root class this type representsint
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.
-
Constructor Details
-
Type
Instantiates a new Type for the provided class- Parameters:
type
- the type- Throws:
java.lang.NullPointerException
- the null pointer exception
-
Type
Instantiates a new Type for the provided class, with the given class as a type param- Parameters:
type
- the typeparam
- the param- Throws:
java.lang.NullPointerException
- the null pointer exception
-
Type
Instantiates a new Type for the provided class, with the given Type as a type param- Parameters:
type
- the typeparam
- the param- Throws:
java.lang.NullPointerException
- the null pointer exception
-
Type
Instantiates a new Type for the provided class, with two type params of the two provided classes- Parameters:
type
- the typeparam1
- the param 1param2
- the param 2
-
Type
Instantiates a new Type for the provided class, with the two type params of the two provided types- Parameters:
type
- the typeparam1
- the param 1param2
- the param 2
-
Type
Instantiates a new Type for the provided class, with an array of type params- Parameters:
type
- the typeparams
- 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.NullPointerExceptionInstantiates a new Type for the provided class, with an array of classes as type params- Parameters:
type
- the typeparams
- 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.NullPointerExceptionInstantiates a new Type for the provided class with a List of classes as the type params- Parameters:
type
- the typeparams
- 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.NullPointerExceptionInstantiates a new Type for the provided class with a list of types as the type params- Parameters:
type
- the typeparams
- the paramsnullDifferentiator
- the null differentiator- Throws:
java.lang.NullPointerException
- the null pointer exception
-
-
Method Details
-
getType
Gets root class this type represents- Returns:
- the 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 classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.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
-