public abstract class TypeDeserializer extends Object
Separate deserialization methods are needed because serialized
form for inclusion mechanism JsonTypeInfo.As.PROPERTY
is slighty different if value is not expressed as JSON Object:
and as such both type deserializer and serializer need to
JSON Object form (array, object or other (== scalar)) being used.
Modifier and Type | Field and Description |
---|---|
protected static Set<String> |
ALLOW_DESER_PACKAGES
Set of allowed packages for bean deserialization.
|
Constructor and Description |
---|
TypeDeserializer() |
Modifier and Type | Method and Description |
---|---|
protected static void |
checkLegalTypes(com.fasterxml.jackson.core.JsonParser parser,
String typeId)
BZ-1507389 and CVEs related to polymorphic deserialization
|
static Object |
deserializeIfNatural(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt,
Class<?> base) |
static Object |
deserializeIfNatural(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt,
JavaType baseType)
Helper method used to check if given parser might be pointing to
a "natural" value, and one that would be acceptable as the
result value (compatible with declared base type)
|
abstract Object |
deserializeTypedFromAny(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt)
Method called to let this type deserializer handle
deserialization of "typed" object, when value itself
may have been serialized using any kind of JSON value
(Array, Object, scalar).
|
abstract Object |
deserializeTypedFromArray(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt)
Method called to let this type deserializer handle
deserialization of "typed" object, when value itself
is serialized as JSON Array (regardless of Java type).
|
abstract Object |
deserializeTypedFromObject(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt)
Method called to let this type deserializer handle
deserialization of "typed" object, when value itself
is serialized as JSON Object (regardless of Java type).
|
abstract Object |
deserializeTypedFromScalar(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt)
Method called to let this type deserializer handle
deserialization of "typed" object, when value itself
is serialized as a scalar JSON value (something other
than Array or Object), regardless of Java type.
|
abstract TypeDeserializer |
forProperty(BeanProperty prop)
Method called to create contextual version, to be used for
values of given property.
|
abstract Class<?> |
getDefaultImpl()
Accessor for "default implementation" type; optionally defined
class to use in cases where type id is not
accessible for some reason (either missing, or can not be
resolved)
|
abstract String |
getPropertyName()
Name of property that contains type information, if
property-based inclusion is used.
|
abstract TypeIdResolver |
getTypeIdResolver()
Accessor for object that handles conversions between
types and matching type ids.
|
abstract com.fasterxml.jackson.annotation.JsonTypeInfo.As |
getTypeInclusion()
Accessor for type information inclusion method
that deserializer uses; indicates how type information
is (expected to be) embedded in JSON input.
|
public abstract TypeDeserializer forProperty(BeanProperty prop)
Collection
or Map
valued properties).public abstract com.fasterxml.jackson.annotation.JsonTypeInfo.As getTypeInclusion()
public abstract String getPropertyName()
public abstract TypeIdResolver getTypeIdResolver()
public abstract Class<?> getDefaultImpl()
public abstract Object deserializeTypedFromObject(com.fasterxml.jackson.core.JsonParser jp, DeserializationContext ctxt) throws IOException
JsonDeserializer
to use, and
call it with JSON data to deserializer (which does not contain
type information).IOException
public abstract Object deserializeTypedFromArray(com.fasterxml.jackson.core.JsonParser jp, DeserializationContext ctxt) throws IOException
JsonDeserializer
to use, and
call it with JSON data to deserializer (which does not contain
type information).IOException
public abstract Object deserializeTypedFromScalar(com.fasterxml.jackson.core.JsonParser jp, DeserializationContext ctxt) throws IOException
JsonDeserializer
to use, and
call it with JSON data to deserializer (which does not contain
type information).IOException
public abstract Object deserializeTypedFromAny(com.fasterxml.jackson.core.JsonParser jp, DeserializationContext ctxt) throws IOException
IOException
public static Object deserializeIfNatural(com.fasterxml.jackson.core.JsonParser jp, DeserializationContext ctxt, JavaType baseType) throws IOException
IOException
public static Object deserializeIfNatural(com.fasterxml.jackson.core.JsonParser jp, DeserializationContext ctxt, Class<?> base) throws IOException
IOException
protected static void checkLegalTypes(com.fasterxml.jackson.core.JsonParser parser, String typeId) throws JsonMappingException
BZ-1507389 and CVEs related to polymorphic deserialization
Check if given type is whitelisted without loading it's class to prevent possible
exploit with static
blocks.
parser
- typeId
- JsonMappingException
Copyright © 2008–2019 FasterXML. All rights reserved.