Package org.codehaus.jackson.map
Class TypeDeserializer
- java.lang.Object
-
- org.codehaus.jackson.map.TypeDeserializer
-
- Direct Known Subclasses:
TypeDeserializerBase
public abstract class TypeDeserializer extends Object
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.PROPERTYis 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.- Since:
- 1.5
- Author:
- tatus
-
-
Constructor Summary
Constructors Constructor Description TypeDeserializer()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract ObjectdeserializeTypedFromAny(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 ObjectdeserializeTypedFromArray(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 ObjectdeserializeTypedFromObject(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 ObjectdeserializeTypedFromScalar(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 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 StringgetPropertyName()Name of property that contains type information, if property-based inclusion is used.abstract TypeIdResolvergetTypeIdResolver()Accessor for object that handles conversions between types and matching type ids.abstract JsonTypeInfo.AsgetTypeInclusion()Accessor for type information inclusion method that deserializer uses; indicates how type information is (expected to be) embedded in JSON input.
-
-
-
Method Detail
-
getTypeInclusion
public abstract JsonTypeInfo.As getTypeInclusion()
Accessor for type information inclusion method that deserializer uses; indicates how type information is (expected to be) embedded in JSON input.
-
getPropertyName
public abstract String getPropertyName()
Name of property that contains type information, if property-based inclusion is used.
-
getTypeIdResolver
public abstract TypeIdResolver getTypeIdResolver()
Accessor for object that handles conversions between types and matching type ids.
-
getDefaultImpl
public 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)- Since:
- 1.9
-
deserializeTypedFromObject
public abstract Object deserializeTypedFromObject(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
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, locateJsonDeserializerto use, and call it with JSON data to deserializer (which does not contain type information).- Throws:
IOExceptionJsonProcessingException
-
deserializeTypedFromArray
public abstract Object deserializeTypedFromArray(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
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, locateJsonDeserializerto use, and call it with JSON data to deserializer (which does not contain type information).- Throws:
IOExceptionJsonProcessingException
-
deserializeTypedFromScalar
public abstract Object deserializeTypedFromScalar(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
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, locateJsonDeserializerto use, and call it with JSON data to deserializer (which does not contain type information).- Throws:
IOExceptionJsonProcessingException
-
deserializeTypedFromAny
public abstract Object deserializeTypedFromAny(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
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:
IOExceptionJsonProcessingException
-
-