Instances can (only) be constructed by
com.fasterxml.jackson.databind.type.TypeFactory.
Since 2.2 this implements java. to allow
it to be pushed through interfaces that only expose that type.
| Modifier and Type | Field and Description |
|---|---|
| protected final boolean | _asStatic
Whether entities defined with this type should be handled using static typing (as opposed to dynamic runtime type) or not. |
| protected final Class | _class
This is the nominal type-erased Class that would be close to the type represented (but not exactly type, due to type erasure: type instance may have more information on this). |
| protected final int | |
| protected final Object | _typeHandler
Optional handler that can be attached to indicate how to handle additional type metadata associated with this type. |
| protected final Object | _valueHandler
Optional handler (codec) that can be attached to indicate what to use for handling (serializing, deserializing) values of this specific type. |
| private static final long |
| Access | Constructor and Description |
|---|---|
| protected | JavaType(Class<?>
"Raw" (type-erased) class for this type raw, int Additional hash code to use, in addition
to hash code of the class name additionalHash, Object internal handler (serializer/deserializer)
to apply for this type valueHandler, Object internal type handler (type serializer/deserializer)
to apply for this type typeHandler, boolean Whether this type declaration will force specific type
as opposed to being a base type (usually for serialization typing) asStatic)Main base constructor for sub-classes to use |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected JavaType | |
| public abstract JavaType | containedType(int
Index of contained type to return index)Implements abstract com. |
| public abstract int | containedTypeCount()
Implements abstract com. |
| public abstract String | containedTypeName(int
Index of contained type to return index)Implements abstract com.
Deprecated
Method for accessing name of type variable in indicated
position.
|
| public JavaType | containedTypeOrUnknown(int index)
Convenience method that is functionally same as:
|
| public abstract boolean | equals(Object
the reference object with which to compare. o)Overrides java. |
| public abstract JavaType | findSuperType(Class<?> erasedTarget)
Method that may be called to find representation of given type within type hierarchy of this type: either this type (if this type has given erased type), one of its supertypes that has the erased types, or null if target is neither this type or any of its supertypes. |
| public abstract JavaType[] | findTypeParameters(Class<?> expType)
Method that may be used to find paramaterization this type has for given type-erased generic target type. |
| public JavaType | forcedNarrowBy(Class<?> subclass)
Deprecated
Legacy method used for forcing sub-typing of this type into
type specified by specific type erasure.
|
| public abstract TypeBindings | |
| public JavaType | getContentType()
Implements abstract com. |
| public Object | Returns: Content type handler associated with this type, if any.Internal accessor that should not be used by any code outside of jackson-databind: only used internally by databind. |
| public Object | Returns: Content value handler associated with this type, if any.Internal accessor that should not be used by any code outside of jackson-databind: only used internally by databind. |
| public String | getErasedSignature()
Method for accessing signature without generic type information, in form compatible with all versions of JVM, and specifically used for type descriptions when generating byte code. |
| public abstract StringBuilder | Returns: StringBuilder that was passed in; returned to allow call chainingStringBuilder to append signature to sb)Method for accessing signature without generic type information, in form compatible with all versions of JVM, and specifically used for type descriptions when generating byte code. |
| public String | getGenericSignature()
Method for accessing signature that contains generic type information, in form compatible with JVM 1.5 as per JLS. |
| public abstract StringBuilder | Returns: StringBuilder that was passed in; returned to allow call chainingStringBuilder to append signature to sb)
|
| public abstract List | getInterfaces()
Accessor for finding fully resolved interfaces this type implements, if any; empty array if none. |
| public JavaType | getKeyType()
Implements abstract com. |
| public Class | getParameterSource()
Overrides com.
Deprecated
|
| public final Class | |
| public JavaType | getReferencedType()
Implements abstract com. |
| public abstract JavaType | getSuperClass()
Accessor for finding fully resolved parent class of this type, if it has one; null if not. |
| public <T> T | Returns: Type handler associated with this type, if any.Internal accessor that should not be used by any code outside of jackson-databind: only used internally by databind. |
| public <T> T | Returns: Value handler associated with this type, if any.Internal accessor that should not be used by any code outside of jackson-databind: only used internally by databind. |
| public boolean | hasContentType()
Accessor that allows determining whether |
| public boolean | hasGenericTypes()
Implements abstract com. |
| public boolean | hasHandlers()
Helper method that checks whether this type, or its (optional) key
or content type has |
| public int | |
| public final boolean | hasRawClass(Class<?> clz)
Implements abstract com. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | Returns: True if type is either truejava. type,
or something similar (meaning it has at least one type parameter,
which describes type of contents)Implements abstract com. |
| public boolean | isConcrete()
Implements abstract com. |
| public abstract boolean | Returns: True if type represented is a container type; this includes array, Map and Collection types.Implements abstract com. |
| public final boolean | isEnumImplType()
Similar to |
| public final boolean | isEnumType()
Implements abstract com. Enum.class.isAssignableFrom(getRawClass()) |
| public final boolean | |
| public final boolean | |
| public boolean | Returns: True if this type is considered "iteration type"Method that returns true if this instance is of type
|
| public final boolean | isJavaLangObject()
Convenience method, short-hand for
|
| public boolean | Returns: True if type is either truejava. type,
or something similar (meaning it has at least two type parameter;
first one describing key type, second value type)Implements abstract com. |
| public final boolean | |
| public final boolean | |
| public boolean | |
| public final boolean | |
| public final boolean | |
| public abstract JavaType | refine(Class<?> rawType, TypeBindings bindings, JavaType superClass, JavaType[] superInterfaces)
Mutant factory method that will try to create and return a sub-type instance for known parameterized types; for other types will return `null` to indicate that no just refinement makes necessary sense, without trying to detect special status through implemented interfaces. |
| public abstract String | |
| public final boolean | useStaticType()
Accessor for checking whether handlers for dealing with values of this type should use static typing (as opposed to dynamic typing). |
| public abstract JavaType | Returns: Newly created type instanceMutant factory method that may be called on structured types that have a so-called content type (element of arrays, value type of Maps, referenced type of referential types), and will construct a new instance that is identical to this instance, except that it has specified content type, instead of current one. |
| public abstract JavaType | Returns: Newly created type instance with same type information, specified handlerHandler to pass to new instance created h)Internal method that should not be used by any code outside of jackson-databind: only used internally by databind. |
| public abstract JavaType | Returns: Newly created type instance with same type information, specified handlerHandler to pass to new instance created h)Internal method that should not be used by any code outside of jackson-databind: only used internally by databind. |
| public JavaType | withHandlersFrom(JavaType src)
Internal method that should not be used by any code outside of jackson-databind: only used internally by databind. |
| public abstract JavaType | withStaticTyping()
Method that can be called to get a type instance that indicates that values of the type should be handled using "static typing" for purposes of serialization (as opposed to "dynamic" aka runtime typing): meaning that no runtime information is needed for determining serializers to use. |
| public abstract JavaType | Returns: Newly created type instance with same type information, specified handlerHandler to pass to new instance created h)Internal method that should not be used by any code outside of jackson-databind: only used internally by databind. |
| public abstract JavaType | Returns: Newly created type instance with same type information, specified handlerHandler to pass to new instance created h)Internal method that should not be used by any code outside of jackson-databind: only used internally by databind. |
| _asStatic | back to summary |
|---|---|
| protected final boolean _asStatic Whether entities defined with this type should be handled using static typing (as opposed to dynamic runtime type) or not.
| |
| _class | back to summary |
|---|---|
| protected final Class<?> _class This is the nominal type-erased Class that would be close to the type represented (but not exactly type, due to type erasure: type instance may have more information on this). May be an interface or abstract class, so instantiation may not be possible. | |
| _hash | back to summary |
|---|---|
| protected final int _hash | |
| _typeHandler | back to summary |
|---|---|
| protected final Object _typeHandler Optional handler that can be attached to indicate how to handle additional type metadata associated with this type. Note untyped (i.e. caller has to cast) because it is used for different kinds of handlers, with unrelated types. | |
| _valueHandler | back to summary |
|---|---|
| protected final Object _valueHandler Optional handler (codec) that can be attached to indicate what to use for handling (serializing, deserializing) values of this specific type. Note untyped (i.e. caller has to cast) because it is used for different kinds of handlers, with unrelated types. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| JavaType | back to summary |
|---|---|
| protected JavaType(Class<?> raw, int additionalHash, Object valueHandler, Object typeHandler, boolean asStatic) Main base constructor for sub-classes to use
| |
| JavaType | back to summary |
|---|---|
| protected JavaType(JavaType base) Copy-constructor used when refining/upgrading type instances.
| |
| _narrow | back to summary |
|---|---|
| protected JavaType _narrow(Class<?> subclass)
Deprecated
| |
| containedType | back to summary |
|---|---|
| public abstract JavaType containedType(int index) Implements abstract com. Doc from com. Method for accessing definitions of contained ("child") types. | |
| containedTypeCount | back to summary |
|---|---|
| public abstract int containedTypeCount() Implements abstract com. Doc from com. Method for checking how many contained types this type has. Contained types are usually generic types, so that generic Maps have 2 contained types.
| |
| containedTypeName | back to summary |
|---|---|
| public abstract String containedTypeName(int index) Implements abstract com. Doc from com. Deprecated
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.
| |
| containedTypeOrUnknown | back to summary |
|---|---|
| public JavaType containedTypeOrUnknown(int index) Convenience method that is functionally same as:
| |
| equals | back to summary |
|---|---|
| public abstract boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| findSuperType | back to summary |
|---|---|
| public abstract JavaType findSuperType(Class<?> erasedTarget) Method that may be called to find representation of given type within type hierarchy of this type: either this type (if this type has given erased type), one of its supertypes that has the erased types, or null if target is neither this type or any of its supertypes.
| |
| findTypeParameters | back to summary |
|---|---|
| public abstract JavaType[] findTypeParameters(Class<?> expType) Method that may be used to find paramaterization this type has for given type-erased generic target type.
| |
| forcedNarrowBy | back to summary |
|---|---|
| public JavaType forcedNarrowBy(Class<?> subclass)
Deprecated
Legacy method used for forcing sub-typing of this type into
type specified by specific type erasure.
Deprecated as of 2.7 as such specializations really ought to
go through
| |
| getBindings | back to summary |
|---|---|
public abstract TypeBindings getBindings()
| |
| getContentType | back to summary |
|---|---|
| public JavaType getContentType() Implements abstract com. Doc from com. 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) | |
| getContentTypeHandler | back to summary |
|---|---|
| public Object getContentTypeHandler() Internal accessor that should not be used by any code outside of jackson-databind: only used internally by databind. May be removed from Jackson 3.0.
| |
| getContentValueHandler | back to summary |
|---|---|
| public Object getContentValueHandler() Internal accessor that should not be used by any code outside of jackson-databind: only used internally by databind. May be removed from Jackson 3.0.
| |
| getErasedSignature | back to summary |
|---|---|
| public String getErasedSignature() Method for accessing signature without generic type information, in form compatible with all versions of JVM, and specifically used for type descriptions when generating byte code. | |
| getErasedSignature | back to summary |
|---|---|
| public abstract StringBuilder getErasedSignature(StringBuilder sb) Method for accessing signature without generic type information, in form compatible with all versions of JVM, and specifically used for type descriptions when generating byte code.
| |
| getGenericSignature | back to summary |
|---|---|
| public String getGenericSignature() Method for accessing signature that contains generic
type information, in form compatible with JVM 1.5
as per JLS. It is a superset of | |
| getGenericSignature | back to summary |
|---|---|
public abstract StringBuilder getGenericSignature(StringBuilder sb)
| |
| getInterfaces | back to summary |
|---|---|
| public abstract List Accessor for finding fully resolved interfaces this type implements, if any; empty array if none.
| |
| getKeyType | back to summary |
|---|---|
| public JavaType getKeyType() Implements abstract com. Doc from com. Method for accessing key type for this type, assuming type has such a concept (only Map types do) | |
| getParameterSource | back to summary |
|---|---|
| public Class Overrides com. Deprecated
| |
| getRawClass | back to summary |
|---|---|
| public final Class Implements abstract com.
| |
| getReferencedType | back to summary |
|---|---|
| public JavaType getReferencedType() Implements abstract com. Doc from com. Method for accessing type of value that instances of this type references, if any. | |
| getSuperClass | back to summary |
|---|---|
| public abstract JavaType getSuperClass() Accessor for finding fully resolved parent class of this type, if it has one; null if not.
| |
| getTypeHandler | back to summary |
|---|---|
| public <T> T getTypeHandler() Internal accessor that should not be used by any code outside of jackson-databind: only used internally by databind. May be removed from Jackson 3.0.
| |
| getValueHandler | back to summary |
|---|---|
| public <T> T getValueHandler() Internal accessor that should not be used by any code outside of jackson-databind: only used internally by databind. May be removed from Jackson 3.0.
| |
| hasContentType | back to summary |
|---|---|
| public boolean hasContentType() Accessor that allows determining whether
| |
| hasGenericTypes | back to summary |
|---|---|
| public boolean hasGenericTypes() Implements abstract com. Doc from com. Method that can be used to find out if the type directly declares generic parameters (for its direct super-class and/or super-interfaces).
| |
| hasHandlers | back to summary |
|---|---|
| public boolean hasHandlers() Helper method that checks whether this type, or its (optional) key
or content type has
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| hasRawClass | back to summary |
|---|---|
| public final boolean hasRawClass(Class<?> clz) Implements abstract com. Method that can be used to check whether this type has specified Class as its type erasure. Put another way, returns true if instantiation of this Type is given (type-erased) Class.
| |
| hasValueHandler | back to summary |
|---|---|
public boolean hasValueHandler()
| |
| isAbstract | back to summary |
|---|---|
| public boolean isAbstract() Implements abstract com.
| |
| isArrayType | back to summary |
|---|---|
| public boolean isArrayType() Implements abstract com.
| |
| isCollectionLikeType | back to summary |
|---|---|
| public boolean isCollectionLikeType() Implements abstract com.
| |
| isConcrete | back to summary |
|---|---|
| public boolean isConcrete() Implements abstract com. Convenience method for checking whether underlying Java type is a concrete class or not: abstract classes and interfaces are not.
| |
| isContainerType | back to summary |
|---|---|
| public abstract boolean isContainerType() Implements abstract com.
| |
| isEnumImplType | back to summary |
|---|---|
| public final boolean isEnumImplType() Similar to
| |
| isEnumType | back to summary |
|---|---|
| public final boolean isEnumType() Implements abstract com. Method that basically does equivalent of: Enum.class.isAssignableFrom(getRawClass())that is, return true if the underlying type erased class is Enum
or one its subtypes (Enum implementations).
| |
| isFinal | back to summary |
|---|---|
| public final boolean isFinal() Implements abstract com.
| |
| isInterface | back to summary |
|---|---|
| public final boolean isInterface() Implements abstract com.
| |
| isIterationType | back to summary |
|---|---|
| public boolean isIterationType() Method that returns true if this instance is of type
| |
| isJavaLangObject | back to summary |
|---|---|
| public final boolean isJavaLangObject() Convenience method, short-hand for
| |
| isMapLikeType | back to summary |
|---|---|
| public boolean isMapLikeType() Implements abstract com.
| |
| isPrimitive | back to summary |
|---|---|
| public final boolean isPrimitive() Implements abstract com.
| |
| isRecordType | back to summary |
|---|---|
public final boolean isRecordType()
| |
| isThrowable | back to summary |
|---|---|
| public boolean isThrowable() Implements abstract com.
| |
| isTypeOrSubTypeOf | back to summary |
|---|---|
public final boolean isTypeOrSubTypeOf(Class<?> clz)
| |
| isTypeOrSuperTypeOf | back to summary |
|---|---|
public final boolean isTypeOrSuperTypeOf(Class<?> clz)
| |
| refine | back to summary |
|---|---|
| public abstract JavaType refine(Class<?> rawType, TypeBindings bindings, JavaType superClass, JavaType[] superInterfaces) Mutant factory method that will try to create and return a sub-type instance for known parameterized types; for other types will return `null` to indicate that no just refinement makes necessary sense, without trying to detect special status through implemented interfaces.
| |
| toString | back to summary |
|---|---|
| public abstract String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| useStaticType | back to summary |
|---|---|
| public final boolean useStaticType() Accessor for checking whether handlers for dealing with values of this type should use static typing (as opposed to dynamic typing). Note that while value of 'true' does mean that static typing is to be used, value of 'false' may still be overridden by other settings.
| |
| withContentType | back to summary |
|---|---|
| public abstract JavaType withContentType(JavaType contentType) Mutant factory method that may be called on structured types
that have a so-called content type (element of arrays, value type
of Maps, referenced type of referential types),
and will construct a new instance that is identical to
this instance, except that it has specified content type, instead of current
one. If content type is already set to given type,
| |
| withContentTypeHandler | back to summary |
|---|---|
| public abstract JavaType withContentTypeHandler(Object h) Internal method that should not be used by any code outside of jackson-databind: only used internally by databind. May be removed from Jackson 3.0. This mutant factory method will construct a new instance that is identical to this instance, except that it will have specified content type (element type for arrays, value type for Maps and so forth) handler assigned. | |
| withContentValueHandler | back to summary |
|---|---|
| public abstract JavaType withContentValueHandler(Object h) Internal method that should not be used by any code outside of jackson-databind: only used internally by databind. May be removed from Jackson 3.0. Mutant factory method that will construct a new instance that is identical to this instance, except that it will have specified content value handler assigned. | |
| withHandlersFrom | back to summary |
|---|---|
| public JavaType withHandlersFrom(JavaType src) Internal method that should not be used by any code outside of jackson-databind: only used internally by databind. May be removed from Jackson 3.0. Mutant factory method that will try to copy handlers that the specified source type instance had, if any; this must be done recursively where necessary (as content types may be structured).
| |
| withStaticTyping | back to summary |
|---|---|
| public abstract JavaType withStaticTyping() Method that can be called to get a type instance that indicates that values of the type should be handled using "static typing" for purposes of serialization (as opposed to "dynamic" aka runtime typing): meaning that no runtime information is needed for determining serializers to use. The main use case is to allow forcing of specific root value serialization type, and specifically in resolving serializers for contained types (element types for arrays, Collections and Maps).
| |
| withTypeHandler | back to summary |
|---|---|
| public abstract JavaType withTypeHandler(Object h) Internal method that should not be used by any code outside of jackson-databind: only used internally by databind. May be removed from Jackson 3.0. This mutant factory method will construct a new instance that is identical to this instance, except that it will have specified type handler assigned. | |
| withValueHandler | back to summary |
|---|---|
| public abstract JavaType withValueHandler(Object h) Internal method that should not be used by any code outside of jackson-databind: only used internally by databind. May be removed from Jackson 3.0. This mutant factory method will construct a new instance that is identical to this instance, except that it will have specified value handler assigned. | |