|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.codehaus.jackson.map.type.TypeFactory
public class TypeFactory
Class that knows how construct JavaType instances,
given various inputs.
| Field Summary | |
|---|---|
protected HashMap<String,JavaType> |
_commonTypeCache
To optimize a common use case, we will use a lookup cache to map straight from raw (type erased) Class instances to matching types, for common simple classes. |
static TypeFactory |
instance
|
| Constructor Summary | |
|---|---|
protected |
TypeFactory()
|
| Method Summary | |
|---|---|
protected JavaType |
_fromArrayType(GenericArrayType type,
JavaType context)
|
protected JavaType |
_fromClass(Class<?> clz,
Map<String,JavaType> genericParams)
|
protected JavaType |
_fromParamType(ParameterizedType type,
JavaType context)
This method deals with parameterized types, that is, first class generic classes. |
JavaType |
_fromType(Type type,
JavaType context)
Factory method that can be used if type information is passed as Java typing returned from getGenericXxx methods
(usually for a return or argument type). |
protected JavaType |
_fromVariable(TypeVariable<?> type,
JavaType context)
|
protected JavaType |
_fromWildcard(WildcardType type,
JavaType context)
|
static JavaType |
fromClass(Class<?> clz)
Factory method that can be used if only type information available is of type Class. |
static JavaType |
fromType(Type type)
Factory method that can be used if type information is passed as Java typing returned from getGenericXxx methods
(usually for a return or argument type). |
static JavaType |
fromType(Type type,
JavaType context)
|
static JavaType |
fromTypeReference(TypeReference<?> ref)
Factory method that can be used if the full generic type has been passed using TypeReference. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final TypeFactory instance
protected final HashMap<String,JavaType> _commonTypeCache
| Constructor Detail |
|---|
protected TypeFactory()
| Method Detail |
|---|
public static JavaType fromClass(Class<?> clz)
Class. This means that there
will not be generic type information due to type erasure,
but at least it will be possible to recognize array
types and non-typed container types.
And for other types (primitives/wrappers, beans), this
is all that is needed.
public static JavaType fromTypeReference(TypeReference<?> ref)
TypeReference. This only needs to be
done if the root type to bind to is generic; but if so,
it must be done to get proper typing.
public static JavaType fromType(Type type)
getGenericXxx methods
(usually for a return or argument type).
public static JavaType fromType(Type type,
JavaType context)
context - Type context that can be used for binding
named formal type parameters, if any (if null, no context
is used)
protected JavaType _fromClass(Class<?> clz,
Map<String,JavaType> genericParams)
genericParams - Mapping of formal parameter declarations (for generic
types) into actual types
public JavaType _fromType(Type type,
JavaType context)
getGenericXxx methods
(usually for a return or argument type).
protected JavaType _fromParamType(ParameterizedType type,
JavaType context)
protected JavaType _fromArrayType(GenericArrayType type,
JavaType context)
protected JavaType _fromVariable(TypeVariable<?> type,
JavaType context)
protected JavaType _fromWildcard(WildcardType type,
JavaType context)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||