org.codehaus.jackson.type
Class TypeReference<T>
java.lang.Object
org.codehaus.jackson.type.TypeReference<T>
- All Implemented Interfaces:
- java.lang.Comparable<TypeReference<T>>
- Direct Known Subclasses:
- TypeReference
public abstract class TypeReference<T>
- extends java.lang.Object
- implements java.lang.Comparable<TypeReference<T>>
This class is based on ideas from
[http://gafter.blogspot.com/2006/12/super-type-tokens.html].
Additional idea (from a suggestion made in comments of the article)
is to require bogus implementation of Comparable
(any such generic interface would do, as long as it forces a method
with generic type to be implemented).
to ensure that a Type argument is indeed given.
|
Method Summary |
int |
compareTo(TypeReference<T> o)
The only reason we define this method (and require implementation
of Comparable) is to prevent constructing a
reference without type information. |
java.lang.reflect.Type |
getType()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TypeReference
protected TypeReference()
getType
public java.lang.reflect.Type getType()
compareTo
public int compareTo(TypeReference<T> o)
- The only reason we define this method (and require implementation
of
Comparable) is to prevent constructing a
reference without type information.
- Specified by:
compareTo in interface java.lang.Comparable<TypeReference<T>>