Package com.fasterxml.jackson.core.type
Class ResolvedType
- java.lang.Object
-
- com.fasterxml.jackson.core.type.ResolvedType
-
- Direct Known Subclasses:
JavaType
public abstract class ResolvedType extends Object
Type abstraction that represents Java type that has been resolved (i.e. has all generic information, if any, resolved to concrete types). Note that this is an intermediate type, and all concrete instances MUST be of typeJavaTypefrom "databind" bundle -- this abstraction is only needed so that types can be passed throughJsonParser.readValueAs(java.lang.Class<T>)methods.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description ResolvedType()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract ResolvedTypecontainedType(int index)Method for accessing definitions of contained ("child") types.abstract intcontainedTypeCount()Method for checking how many contained types this type has.abstract StringcontainedTypeName(int index)Method for accessing name of type variable in indicated position.abstract ResolvedTypegetContentType()Method for accessing content type of this type, if type has such a thing: simple types do not, structured types do (like arrays, Collections and Maps)abstract ResolvedTypegetKeyType()Method for accessing key type for this type, assuming type has such a concept (only Map types do)Class<?>getParameterSource()Deprecated.Since 2.7: does not have meaning as parameters depend on type resolved.abstract Class<?>getRawClass()abstract ResolvedTypegetReferencedType()Method for accessing type of value that instances of this type references, if any.abstract booleanhasGenericTypes()Method that can be used to find out if the type directly declares generic parameters (for its direct super-class and/or super-interfaces).abstract booleanhasRawClass(Class<?> clz)abstract booleanisAbstract()abstract booleanisArrayType()abstract booleanisCollectionLikeType()abstract booleanisConcrete()abstract booleanisContainerType()abstract booleanisEnumType()abstract booleanisFinal()abstract booleanisInterface()abstract booleanisMapLikeType()abstract booleanisPrimitive()booleanisReferenceType()Whether this type is a referential type, meaning that values are basically pointers to "real" values (or null) and not regular values themselves.abstract booleanisThrowable()abstract StringtoCanonical()Method that can be used to serialize type into form from which it can be fully deserialized from at a later point (usingTypeFactoryfrom mapper package).
-
-
-
Method Detail
-
hasRawClass
public abstract boolean hasRawClass(Class<?> clz)
-
isAbstract
public abstract boolean isAbstract()
-
isConcrete
public abstract boolean isConcrete()
-
isThrowable
public abstract boolean isThrowable()
-
isArrayType
public abstract boolean isArrayType()
-
isEnumType
public abstract boolean isEnumType()
-
isInterface
public abstract boolean isInterface()
-
isPrimitive
public abstract boolean isPrimitive()
-
isFinal
public abstract boolean isFinal()
-
isContainerType
public abstract boolean isContainerType()
-
isCollectionLikeType
public abstract boolean isCollectionLikeType()
-
isReferenceType
public boolean isReferenceType()
Whether this type is a referential type, meaning that values are basically pointers to "real" values (or null) and not regular values themselves. Typical examples include things likeAtomicReference, and variousOptionaltypes (in JDK8, Guava).- Returns:
Trueif this is a "referential" type,falseif not- Since:
- 2.6
-
isMapLikeType
public abstract boolean isMapLikeType()
-
hasGenericTypes
public abstract boolean hasGenericTypes()
Method that can be used to find out if the type directly declares generic parameters (for its direct super-class and/or super-interfaces).- Returns:
Trueif this type has generic type parameters,falseif not
-
getParameterSource
@Deprecated public Class<?> getParameterSource()
Deprecated.Since 2.7: does not have meaning as parameters depend on type resolved.- Returns:
- Type-erased class of something not usable at this point
-
getKeyType
public abstract ResolvedType getKeyType()
Method for accessing key type for this type, assuming type has such a concept (only Map types do)- Returns:
- Key type of this type, if any;
nullif none
-
getContentType
public abstract ResolvedType getContentType()
Method for accessing content type of this type, if type has such a thing: simple types do not, structured types do (like arrays, Collections and Maps)- Returns:
- Content type of this type, if any;
nullif none
-
getReferencedType
public abstract ResolvedType getReferencedType()
Method for accessing type of value that instances of this type references, if any.- Returns:
- Referenced type, if any;
nullif not. - Since:
- 2.6
-
containedTypeCount
public abstract int containedTypeCount()
Method for checking how many contained types this type has. Contained types are usually generic types, so that generic Maps have 2 contained types.- Returns:
- Number of contained types that may be accessed
-
containedType
public abstract ResolvedType containedType(int index)
Method for accessing definitions of contained ("child") types.- Parameters:
index- Index of contained type to return- Returns:
- Contained type at index, or null if no such type exists (no exception thrown)
-
containedTypeName
public abstract String containedTypeName(int index)
Method for accessing name of type variable in indicated position. If no name is bound, will use placeholders (derived from 0-based index); if no type variable or argument exists with given index, null is returned.- Parameters:
index- Index of contained type to return- Returns:
- Contained type at index, or null if no such type exists (no exception thrown)
-
toCanonical
public abstract String toCanonical()
Method that can be used to serialize type into form from which it can be fully deserialized from at a later point (usingTypeFactoryfrom mapper package). For simple types this is same as callingClass.getName(), but for structured types it may additionally contain type information about contents.- Returns:
- String representation of the fully resolved type
-
-