Class TypeDeserializer
java.lang.Object
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.jsontype.TypeDeserializer
- Direct Known Subclasses:
TypeDeserializerBase
Interface for deserializing type information from JSON content, to
type-safely deserialize data into correct polymorphic instance
(when type inclusion has been enabled for type handled).
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.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
deserializeIfNatural
(JsonParser p, 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)static Object
deserializeIfNatural
(JsonParser p, DeserializationContext ctxt, Class<?> base) abstract Object
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
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
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
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<?>
Accessor for "default implementation" type; optionally defined class to use in cases where type id is not accessible for some reason (either missing, or cannot be resolved)abstract String
Name of property that contains type information, if property-based inclusion is used.abstract TypeIdResolver
Accessor for object that handles conversions between types and matching type ids.abstract JsonTypeInfo.As
Accessor for type information inclusion method that deserializer uses; indicates how type information is (expected to be) embedded in JSON input.boolean
-
Constructor Details
-
TypeDeserializer
public TypeDeserializer()
-
-
Method Details
-
forProperty
Method called to create contextual version, to be used for values of given property. This may be the type itself (as is the case for bean properties), or values contained (forCollection
orMap
valued properties). -
getTypeInclusion
Accessor for type information inclusion method that deserializer uses; indicates how type information is (expected to be) embedded in JSON input. -
getPropertyName
Name of property that contains type information, if property-based inclusion is used. -
getTypeIdResolver
Accessor for object that handles conversions between types and matching type ids. -
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 cannot be resolved) -
hasDefaultImpl
public boolean hasDefaultImpl()- Since:
- 2.12
-
deserializeTypedFromObject
public abstract Object deserializeTypedFromObject(JsonParser p, DeserializationContext ctxt) throws IOException Method called to let this type deserializer handle deserialization of "typed" object, when value itself is serialized as JSON Object (regardless of Java type). Method needs to figure out intended polymorphic type, locateJsonDeserializer
to use, and call it with JSON data to deserializer (which does not contain type information).- Throws:
IOException
-
deserializeTypedFromArray
public abstract Object deserializeTypedFromArray(JsonParser p, DeserializationContext ctxt) throws IOException Method called to let this type deserializer handle deserialization of "typed" object, when value itself is serialized as JSON Array (regardless of Java type). Method needs to figure out intended polymorphic type, locateJsonDeserializer
to use, and call it with JSON data to deserializer (which does not contain type information).- Throws:
IOException
-
deserializeTypedFromScalar
public abstract Object deserializeTypedFromScalar(JsonParser p, DeserializationContext ctxt) throws IOException 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. Method needs to figure out intended polymorphic type, locateJsonDeserializer
to use, and call it with JSON data to deserializer (which does not contain type information).- Throws:
IOException
-
deserializeTypedFromAny
public abstract Object deserializeTypedFromAny(JsonParser p, DeserializationContext ctxt) throws IOException 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). Should only be called if JSON serialization is polymorphic (not Java type); for example when using JSON node representation, or "untyped" Java object (which may be Map, Collection, wrapper/primitive etc).- Throws:
IOException
-
deserializeIfNatural
public static Object deserializeIfNatural(JsonParser p, DeserializationContext ctxt, JavaType baseType) throws IOException 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)- Throws:
IOException
-
deserializeIfNatural
public static Object deserializeIfNatural(JsonParser p, DeserializationContext ctxt, Class<?> base) throws IOException - Throws:
IOException
-