com.fasterxml.jackson.databind.jsontype.impl
Class AsWrapperTypeDeserializer

java.lang.Object
  extended by com.fasterxml.jackson.databind.jsontype.TypeDeserializer
      extended by com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase
          extended by com.fasterxml.jackson.databind.jsontype.impl.AsWrapperTypeDeserializer

public class AsWrapperTypeDeserializer
extends TypeDeserializerBase

Type deserializer used with JsonTypeInfo.As.WRAPPER_OBJECT inclusion mechanism. Simple since JSON structure used is always the same, regardless of structure used for actual value: wrapping is done using a single-element JSON Object where type id is the key, and actual object data as the value.

Author:
tatu

Field Summary
 
Fields inherited from class com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase
_baseType, _defaultImpl, _defaultImplDeserializer, _deserializers, _idResolver, _property, _typeIdVisible, _typePropertyName
 
Constructor Summary
protected AsWrapperTypeDeserializer(AsWrapperTypeDeserializer src, BeanProperty property)
           
  AsWrapperTypeDeserializer(JavaType bt, TypeIdResolver idRes, String typePropertyName, boolean typeIdVisible, Class<?> defaultImpl)
           
 
Method Summary
 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).
 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).
 Object deserializeTypedFromObject(com.fasterxml.jackson.core.JsonParser jp, DeserializationContext ctxt)
          Deserializing type id enclosed using WRAPPER_OBJECT style is straightforward
 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.
 TypeDeserializer forProperty(BeanProperty prop)
          Method called to create contextual version, to be used for values of given property.
 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.
 
Methods inherited from class com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase
_findDefaultImplDeserializer, _findDeserializer, baseTypeName, getDefaultImpl, getPropertyName, getTypeIdResolver, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AsWrapperTypeDeserializer

public AsWrapperTypeDeserializer(JavaType bt,
                                 TypeIdResolver idRes,
                                 String typePropertyName,
                                 boolean typeIdVisible,
                                 Class<?> defaultImpl)

AsWrapperTypeDeserializer

protected AsWrapperTypeDeserializer(AsWrapperTypeDeserializer src,
                                    BeanProperty property)
Method Detail

forProperty

public TypeDeserializer forProperty(BeanProperty prop)
Description copied from class: TypeDeserializer
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 (for Collection or Map valued properties).

Specified by:
forProperty in class TypeDeserializerBase

getTypeInclusion

public com.fasterxml.jackson.annotation.JsonTypeInfo.As getTypeInclusion()
Description copied from class: TypeDeserializer
Accessor for type information inclusion method that deserializer uses; indicates how type information is (expected to be) embedded in JSON input.

Specified by:
getTypeInclusion in class TypeDeserializerBase

deserializeTypedFromObject

public Object deserializeTypedFromObject(com.fasterxml.jackson.core.JsonParser jp,
                                         DeserializationContext ctxt)
                                  throws IOException,
                                         com.fasterxml.jackson.core.JsonProcessingException
Deserializing type id enclosed using WRAPPER_OBJECT style is straightforward

Specified by:
deserializeTypedFromObject in class TypeDeserializer
Throws:
IOException
com.fasterxml.jackson.core.JsonProcessingException

deserializeTypedFromArray

public Object deserializeTypedFromArray(com.fasterxml.jackson.core.JsonParser jp,
                                        DeserializationContext ctxt)
                                 throws IOException,
                                        com.fasterxml.jackson.core.JsonProcessingException
Description copied from class: TypeDeserializer
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, locate JsonDeserializer to use, and call it with JSON data to deserializer (which does not contain type information).

Specified by:
deserializeTypedFromArray in class TypeDeserializer
Throws:
IOException
com.fasterxml.jackson.core.JsonProcessingException

deserializeTypedFromScalar

public Object deserializeTypedFromScalar(com.fasterxml.jackson.core.JsonParser jp,
                                         DeserializationContext ctxt)
                                  throws IOException,
                                         com.fasterxml.jackson.core.JsonProcessingException
Description copied from class: TypeDeserializer
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, locate JsonDeserializer to use, and call it with JSON data to deserializer (which does not contain type information).

Specified by:
deserializeTypedFromScalar in class TypeDeserializer
Throws:
IOException
com.fasterxml.jackson.core.JsonProcessingException

deserializeTypedFromAny

public Object deserializeTypedFromAny(com.fasterxml.jackson.core.JsonParser jp,
                                      DeserializationContext ctxt)
                               throws IOException,
                                      com.fasterxml.jackson.core.JsonProcessingException
Description copied from class: TypeDeserializer
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).

Specified by:
deserializeTypedFromAny in class TypeDeserializer
Throws:
IOException
com.fasterxml.jackson.core.JsonProcessingException


Copyright © 2012 fasterxml.com. All Rights Reserved.