public abstract class TypeReference<T extends Type> extends java.lang.Object implements java.lang.Comparable<TypeReference<T>>
Array types.
See this blog post for further details.
It may make sense to switch to using Java's reflection Type to avoid working around this fundamental generics limitation.
| Modifier and Type | Class and Description |
|---|---|
static class |
TypeReference.StaticArrayTypeReference<T extends Type> |
| Modifier | Constructor and Description |
|---|---|
protected |
TypeReference() |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(TypeReference<T> o) |
static <T extends Type> |
create(java.lang.Class<T> cls) |
static <T extends Type> |
create(int length,
java.lang.reflect.ParameterizedType type) |
static <T extends Type> |
create(java.lang.reflect.ParameterizedType type) |
java.lang.Class<T> |
getClassType()
Workaround to ensure type does not come back as T due to erasure, this enables you to
create a TypeReference via
Class<T>. |
java.lang.reflect.Type |
getType() |
public int compareTo(TypeReference<T> o)
compareTo in interface java.lang.Comparable<TypeReference<T extends Type>>public java.lang.reflect.Type getType()
public java.lang.Class<T> getClassType() throws java.lang.ClassNotFoundException
Class<T>.java.lang.ClassNotFoundException - if the class type cannot be determinedpublic static <T extends Type> TypeReference<T> create(java.lang.Class<T> cls)
public static <T extends Type> TypeReference<T> create(java.lang.reflect.ParameterizedType type)
public static <T extends Type> TypeReference.StaticArrayTypeReference<T> create(int length, java.lang.reflect.ParameterizedType type)