org.springframework.core
Class ParameterizedTypeReference<T>
java.lang.Object
org.springframework.core.ParameterizedTypeReference<T>
public abstract class ParameterizedTypeReference<T>
- extends java.lang.Object
The purpose of this class is to enable capturing and passing a generic
Type. In order to capture the generic type and retain it at runtime,
you need to create a subclass as follows:
ParameterizedTypeReference<List<String>> typeRef = new ParameterizedTypeReference<List<String>>() {};
The resulting typeReference instance can then be used to obtain a
Type instance that carries parameterized type information.
For more information on "super type tokens" see the link to Neal Gafter's blog post.
- Since:
- 2.0
- Author:
- Arjen Poutsma, Rossen Stoyanchev
- See Also:
- Neal Gafter on Super Type Tokens
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
ParameterizedTypeReference
protected ParameterizedTypeReference()
getType
public java.lang.reflect.Type getType()
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode in class java.lang.Object
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object