public class TypeReference<T>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Set<java.lang.reflect.Type> |
components |
| Modifier | Constructor and Description |
|---|---|
protected |
TypeReference() |
| Modifier and Type | Method and Description |
|---|---|
TypeReference<T> |
canonicalize()
Removes the reference for the upper class.
|
protected java.lang.Object |
clone() |
boolean |
equals(java.lang.Object o)
Checks if the given object is equal
to this object.
|
protected void |
finalize() |
TypeReference<?> |
getFieldType(java.lang.reflect.Field field) |
java.lang.Class<T> |
getRawType() |
java.lang.reflect.Type |
getType() |
int |
hashCode() |
boolean |
isPureRawType()
Determines if the
TypeReference represented by this is a raw-type |
static <K,V> TypeReference<java.util.Map<K,V>> |
mapTypeOf(TypeReference<K> key,
TypeReference<V> value) |
static <T> TypeReference<T> |
of(java.lang.Class<?> rawType,
java.lang.reflect.Type... typeArguments) |
static <T> TypeReference<T> |
of(java.lang.reflect.Type type) |
boolean |
requiresContext() |
boolean |
requiresContext()
Calls recursively
CompositeType#requiresContext()
in the component types. |
TypeReference<?> |
resolve(java.lang.reflect.Type type)
Unsafe method, type must be the type of a member of this type,
else, it throws a
IllegalStateException |
java.lang.String |
toString() |
public static <T> TypeReference<T> of(java.lang.reflect.Type type)
public static <T> TypeReference<T> of(java.lang.Class<?> rawType, java.lang.reflect.Type... typeArguments)
public static <K,V> TypeReference<java.util.Map<K,V>> mapTypeOf(TypeReference<K> key, TypeReference<V> value)
public final boolean isPureRawType()
TypeReference represented by this is a raw-typetrue if the TypeReference represented by this is a raw-typepublic final TypeReference<?> getFieldType(java.lang.reflect.Field field)
public final TypeReference<?> resolve(java.lang.reflect.Type type)
IllegalStateExceptiontype - The type to resolvepublic final java.lang.Class<T> getRawType()
public final java.lang.reflect.Type getType()
public final TypeReference<T> canonicalize()
TypeReference
in cache, you should execute this method before.public final int hashCode()
public final boolean equals(java.lang.Object o)
CompositeType may break the
symmetry contract of the equals method.
Why "may"? Because some implementations of
Type checks if the compared object
class is the same as the implementation
This is because the types must be
wrapped before invoking Object.equals(java.lang.Object)
in any type
public final java.lang.String toString()
toString in class java.lang.Objectprotected final java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionprotected final void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic boolean requiresContext()
public boolean requiresContext()
CompositeType#requiresContext()
in the component types.