类 TypeReference<T>
- java.lang.Object
-
- com.getui.push.v2.sdk.common.type.TypeReference<T>
-
- 所有已实现的接口:
Comparable<TypeReference<T>>
public abstract class TypeReference<T> extends Object implements Comparable<TypeReference<T>>
This generic abstract class is used for obtaining full generics type information by sub-classing; it must be converted tocom.fasterxml.jackson.core.type.ResolvedTypeimplementation (implemented byJavaTypefrom "databind" bundle) to be used. 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 ofComparable(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.Usage is by sub-classing: here is one way to instantiate reference to generic type
List<Integer>:TypeReference ref = new TypeReference<List<Integer>>() { };which can be passed to methods that accept TypeReference, or resolved usingTypeFactoryto obtaincom.fasterxml.jackson.core.type.ResolvedType.
-
-
构造器概要
构造器 限定符 构造器 说明 protectedTypeReference()
-
-
-
字段详细资料
-
_type
protected final Type _type
-
-
方法详细资料
-
getType
public Type getType()
-
compareTo
public int compareTo(TypeReference<T> o)
The only reason we define this method (and require implementation ofComparable) is to prevent constructing a reference without type information.- 指定者:
compareTo在接口中Comparable<T>
-
-