Top Description Fields Constructors Methods
tools.jackson.databind

public abstract Class JavaType

extends ResolvedType
implements Serializable, Type
Class Inheritance
All Implemented Interfaces
java.lang.reflect.Type, java.io.Serializable
Known Direct Subclasses
tools.jackson.databind.type.TypeBase
Imports
java.lang.reflect.Modifier, java.util.List, tools.jackson.core.type.ResolvedType, tools.jackson.databind.type.TypeBindings, .TypeFactory, tools.jackson.databind.util.ClassUtil

Base class for type token classes used both to contain information and as keys for deserializers.

Instances can (only) be constructed by tools.jackson.databind.type.TypeFactory.

Field Summary

Modifier and TypeField 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

Constructor Summary

AccessConstructor 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
JavaType(JavaType base)

Copy-constructor used when refining/upgrading type instances.

Method Summary

Modifier and TypeMethod and Description
public abstract JavaType
containedType(int index)

Implements abstract tools.jackson.core.type.ResolvedType.containedType.

Method for accessing definitions of contained ("child") types.

public abstract int
containedTypeCount()

Implements abstract tools.jackson.core.type.ResolvedType.containedTypeCount.

Method for checking how many contained types this type has.

public JavaType
containedTypeOrUnknown(int index)

Convenience method that is functionally same as: JavaType t = containedType(index); if (t == null) { t = TypeFactory.unknownType(); } and typically used to eliminate need for null checks for common case where we just want to check if containedType is available first; and if not, use "unknown type" (which translates to java.lang.Object basically).

public abstract boolean
equals(Object o)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

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 abstract TypeBindings
public JavaType
getContentType()

Implements abstract tools.jackson.core.type.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)

public Object

Returns:

Content type handler associated with this type, if any.
getContentTypeHandler
()

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.
getContentValueHandler
()

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 chaining
getErasedSignature
(StringBuilder
StringBuilder 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 chaining
getGenericSignature
(StringBuilder
StringBuilder to append signature to
sb
)

public abstract List<JavaType>
getInterfaces()

Accessor for finding fully resolved interfaces this type implements, if any; empty array if none.

public JavaType
getKeyType()

Implements abstract tools.jackson.core.type.ResolvedType.getKeyType.

Method for accessing key type for this type, assuming type has such a concept (only Map types do)

public final Class<?>
public JavaType
getReferencedType()

Implements abstract tools.jackson.core.type.ResolvedType.getReferencedType.

Method for accessing type of value that instances of this type references, if any.

public abstract JavaType
getSuperClass()

Accessor for finding fully resolved parent class of this type, if it has one; null if not.

public Object

Returns:

Type handler associated with this type, if any.
getTypeHandler
()

Internal accessor that should not be used by any code outside of jackson-databind: only used internally by databind.

public Object

Returns:

Value handler associated with this type, if any.
getValueHandler
()

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 getContentType() should return a non-null value (that is, there is a "content type") or not.

public boolean
hasGenericTypes()

Implements abstract tools.jackson.core.type.ResolvedType.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).

public boolean
hasHandlers()

Helper method that checks whether this type, or its (optional) key or content type has getValueHandler or getTypeHandler(); that is, are there any non-standard handlers associated with this type object.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public final boolean
hasRawClass(Class<?> clz)

Implements abstract tools.jackson.core.type.ResolvedType.hasRawClass.

Method that can be used to check whether this type has specified Class as its type erasure.

public boolean
public boolean
public boolean
public boolean

Returns:

True if type is either true java.util.Collection type, or something similar (meaning it has at least one type parameter, which describes type of contents)
isCollectionLikeType
()

Implements abstract tools.jackson.core.type.ResolvedType.isCollectionLikeType.

public boolean
isConcrete()

Implements abstract tools.jackson.core.type.ResolvedType.isConcrete.

Convenience method for checking whether underlying Java type is a concrete class or not: abstract classes and interfaces are not.

public abstract boolean

Returns:

True if type represented is a container type; this includes array, Map and Collection types.
isContainerType
()

Implements abstract tools.jackson.core.type.ResolvedType.isContainerType.

public final boolean
isEnumImplType()

Similar to isEnumType except does NOT return true for java.lang.Enum (since that is not Enum implementation type).

public final boolean
isEnumType()

Implements abstract tools.jackson.core.type.ResolvedType.isEnumType.

Method that basically does equivalent of:

  Enum.class.isAssignableFrom(getRawClass())
public final boolean
public final boolean
public boolean

Returns:

True if this type is considered "iteration type"
isIterationType
()

Method that returns true if this instance is of type IterationType.

public final boolean
isJavaLangObject()

Convenience method, short-hand for getRawClass() == Object.class and used to figure if we basically have "untyped" type object.

public boolean

Returns:

True if type is either true java.util.Map type, or something similar (meaning it has at least two type parameter; first one describing key type, second value type)
isMapLikeType
()

Implements abstract tools.jackson.core.type.ResolvedType.isMapLikeType.

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
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

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 instance
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.

public abstract JavaType

Returns:

Newly created type instance with same type information, specified handler
withContentTypeHandler
(Object
Handler 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 handler
withContentValueHandler
(Object
Handler 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 handler
withTypeHandler
(Object
Handler 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 handler
withValueHandler
(Object
Handler 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.

Inherited from tools.jackson.core.type.ResolvedType:
isReferenceTypetoCanonical

Field Detail

_asStaticback 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.

_classback 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.

_hashback to summary
protected final int _hash
_typeHandlerback 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.

_valueHandlerback 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.

serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

JavaTypeback to summary
protected JavaType(Class<?> raw, int additionalHash, Object valueHandler, Object typeHandler, boolean asStatic)

Main base constructor for sub-classes to use

Parameters
raw:Class<?>

"Raw" (type-erased) class for this type

additionalHash:int

Additional hash code to use, in addition to hash code of the class name

valueHandler:Object

internal handler (serializer/deserializer) to apply for this type

typeHandler:Object

internal type handler (type serializer/deserializer) to apply for this type

asStatic:boolean

Whether this type declaration will force specific type as opposed to being a base type (usually for serialization typing)

JavaTypeback to summary
protected JavaType(JavaType base)

Copy-constructor used when refining/upgrading type instances.

Method Detail

containedTypeback to summary
public abstract JavaType containedType(int index)

Implements abstract tools.jackson.core.type.ResolvedType.containedType.

Doc from tools.jackson.core.type.ResolvedType.containedType.

Method for accessing definitions of contained ("child") types.

Annotations
@Override
containedTypeCountback to summary
public abstract int containedTypeCount()

Implements abstract tools.jackson.core.type.ResolvedType.containedTypeCount.

Doc from tools.jackson.core.type.ResolvedType.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.

Annotations
@Override
containedTypeOrUnknownback to summary
public JavaType containedTypeOrUnknown(int index)

Convenience method that is functionally same as: JavaType t = containedType(index); if (t == null) { t = TypeFactory.unknownType(); } and typically used to eliminate need for null checks for common case where we just want to check if containedType is available first; and if not, use "unknown type" (which translates to java.lang.Object basically).

equalsback to summary
public abstract boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

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.

Annotations
@Override
findSuperTypeback 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.

findTypeParametersback 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.

getBindingsback to summary
public abstract TypeBindings getBindings()
getContentTypeback to summary
public JavaType getContentType()

Implements abstract tools.jackson.core.type.ResolvedType.getContentType.

Doc from tools.jackson.core.type.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)

Annotations
@Override
getContentTypeHandlerback 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.

Returns:Object

Content type handler associated with this type, if any.

getContentValueHandlerback 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.

Returns:Object

Content value handler associated with this type, if any.

getErasedSignatureback 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.

getErasedSignatureback 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.

Parameters
sb:StringBuilder

StringBuilder to append signature to

Returns:StringBuilder

StringBuilder that was passed in; returned to allow call chaining

getGenericSignatureback 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 getErasedSignature, in that generic information can be automatically removed if necessary (just remove outermost angle brackets along with content inside)

getGenericSignatureback to summary
public abstract StringBuilder getGenericSignature(StringBuilder sb)
Parameters
sb:StringBuilder

StringBuilder to append signature to

Returns:StringBuilder

StringBuilder that was passed in; returned to allow call chaining

getInterfacesback to summary
public abstract List<JavaType> getInterfaces()

Accessor for finding fully resolved interfaces this type implements, if any; empty array if none.

getKeyTypeback to summary
public JavaType getKeyType()

Implements abstract tools.jackson.core.type.ResolvedType.getKeyType.

Doc from tools.jackson.core.type.ResolvedType.getKeyType.

Method for accessing key type for this type, assuming type has such a concept (only Map types do)

Annotations
@Override
getRawClassback to summary
public final Class<?> getRawClass()

Implements abstract tools.jackson.core.type.ResolvedType.getRawClass.

Annotations
@Override
getReferencedTypeback to summary
public JavaType getReferencedType()

Implements abstract tools.jackson.core.type.ResolvedType.getReferencedType.

Doc from tools.jackson.core.type.ResolvedType.getReferencedType.

Method for accessing type of value that instances of this type references, if any.

Annotations
@Override
getSuperClassback to summary
public abstract JavaType getSuperClass()

Accessor for finding fully resolved parent class of this type, if it has one; null if not.

getTypeHandlerback to summary
public Object 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.

Returns:Object

Type handler associated with this type, if any.

getValueHandlerback to summary
public Object 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.

Returns:Object

Value handler associated with this type, if any.

hasContentTypeback to summary
public boolean hasContentType()

Accessor that allows determining whether getContentType() should return a non-null value (that is, there is a "content type") or not. True if isContainerType() or isReferenceType() return true.

hasGenericTypesback to summary
public boolean hasGenericTypes()

Implements abstract tools.jackson.core.type.ResolvedType.hasGenericTypes.

Doc from tools.jackson.core.type.ResolvedType.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).

Annotations
@Override
hasHandlersback to summary
public boolean hasHandlers()

Helper method that checks whether this type, or its (optional) key or content type has getValueHandler or getTypeHandler(); that is, are there any non-standard handlers associated with this type object.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
hasRawClassback to summary
public final boolean hasRawClass(Class<?> clz)

Implements abstract tools.jackson.core.type.ResolvedType.hasRawClass.

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.

Annotations
@Override
hasValueHandlerback to summary
public boolean hasValueHandler()
isAbstractback to summary
public boolean isAbstract()

Implements abstract tools.jackson.core.type.ResolvedType.isAbstract.

Annotations
@Override
isArrayTypeback to summary
public boolean isArrayType()

Implements abstract tools.jackson.core.type.ResolvedType.isArrayType.

Annotations
@Override
isCollectionLikeTypeback to summary
public boolean isCollectionLikeType()

Implements abstract tools.jackson.core.type.ResolvedType.isCollectionLikeType.

Returns:boolean

True if type is either true java.util.Collection type, or something similar (meaning it has at least one type parameter, which describes type of contents)

Annotations
@Override
isConcreteback to summary
public boolean isConcrete()

Implements abstract tools.jackson.core.type.ResolvedType.isConcrete.

Convenience method for checking whether underlying Java type is a concrete class or not: abstract classes and interfaces are not.

Annotations
@Override
isContainerTypeback to summary
public abstract boolean isContainerType()

Implements abstract tools.jackson.core.type.ResolvedType.isContainerType.

Returns:boolean

True if type represented is a container type; this includes array, Map and Collection types.

Annotations
@Override
isEnumImplTypeback to summary
public final boolean isEnumImplType()

Similar to isEnumType except does NOT return true for java.lang.Enum (since that is not Enum implementation type).

isEnumTypeback to summary
public final boolean isEnumType()

Implements abstract tools.jackson.core.type.ResolvedType.isEnumType.

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).
Annotations
@Override
isFinalback to summary
public final boolean isFinal()

Implements abstract tools.jackson.core.type.ResolvedType.isFinal.

Annotations
@Override
isInterfaceback to summary
public final boolean isInterface()

Implements abstract tools.jackson.core.type.ResolvedType.isInterface.

Annotations
@Override
isIterationTypeback to summary
public boolean isIterationType()

Method that returns true if this instance is of type IterationType.

Returns:boolean

True if this type is considered "iteration type"

Since
2.16
isJavaLangObjectback to summary
public final boolean isJavaLangObject()

Convenience method, short-hand for getRawClass() == Object.class and used to figure if we basically have "untyped" type object.

isMapLikeTypeback to summary
public boolean isMapLikeType()

Implements abstract tools.jackson.core.type.ResolvedType.isMapLikeType.

Returns:boolean

True if type is either true java.util.Map type, or something similar (meaning it has at least two type parameter; first one describing key type, second value type)

Annotations
@Override
isPrimitiveback to summary
public final boolean isPrimitive()

Implements abstract tools.jackson.core.type.ResolvedType.isPrimitive.

Annotations
@Override
isRecordTypeback to summary
public final boolean isRecordType()
Since
2.12
isThrowableback to summary
public boolean isThrowable()

Implements abstract tools.jackson.core.type.ResolvedType.isThrowable.

Annotations
@Override
isTypeOrSubTypeOfback to summary
public final boolean isTypeOrSubTypeOf(Class<?> clz)
isTypeOrSuperTypeOfback to summary
public final boolean isTypeOrSuperTypeOf(Class<?> clz)
refineback 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.

toStringback to summary
public abstract String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
useStaticTypeback 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.

withContentTypeback 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, this is returned. If type does not have a content type (which is the case with SimpleType), IllegalArgumentException will be thrown.

Returns:JavaType

Newly created type instance

withContentTypeHandlerback 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.

Parameters
h:Object

Handler to pass to new instance created

Returns:JavaType

Newly created type instance with same type information, specified handler

withContentValueHandlerback 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.

Parameters
h:Object

Handler to pass to new instance created

Returns:JavaType

Newly created type instance with same type information, specified handler

withHandlersFromback 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).

withStaticTypingback 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).

withTypeHandlerback 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.

Parameters
h:Object

Handler to pass to new instance created

Returns:JavaType

Newly created type instance with same type information, specified handler

withValueHandlerback 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.

Parameters
h:Object

Handler to pass to new instance created

Returns:JavaType

Newly created type instance with same type information, specified handler