Top Description Inners Fields Constructors Methods
com.fasterxml.jackson.databind.deser.impl

public Class ExternalTypeHandler

extends Object
Class Inheritance
Imports
java.io.IOException, java.util.*, com.fasterxml.jackson.core.*, com.fasterxml.jackson.databind.*, com.fasterxml.jackson.databind.deser.SettableBeanProperty, com.fasterxml.jackson.databind.jsontype.TypeDeserializer, com.fasterxml.jackson.databind.util.TokenBuffer

Helper class that is used to flatten JSON structure when using "external type id" (see com.fasterxml.jackson.annotation.JsonTypeInfo.As#EXTERNAL_PROPERTY). This is needed to store temporary state and buffer tokens, as the structure is rearranged a bit so that actual type deserializer can resolve type and finalize deserialization.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
private static class

Field Summary

Modifier and TypeField and Description
private final JavaType
private final Map<String, Object>
_nameToPropertyIndex

Mapping from external property ids to one or more indexes; in most cases single index as Integer, but occasionally same name maps to multiple ones: if so, List<Integer>.

private final ExternalTypeHandler.ExtTypedProperty[]
private final TokenBuffer[]
private final String[]

Constructor Summary

AccessConstructor and Description
protected
ExternalTypeHandler(JavaType beanType, ExternalTypeHandler.ExtTypedProperty[] properties, Map<String, Object> nameToPropertyIndex, String[] typeIds, TokenBuffer[] tokens)

protected

Method Summary

Modifier and TypeMethod and Description
protected final Object
protected final void
protected final Object
private final boolean
_handleTypePropertyValue(JsonParser p, DeserializationContext ctxt, String propName, Object bean, String typeId, int index)

public static ExternalTypeHandler.Builder
builder(JavaType beanType)

public Object
complete(JsonParser p, DeserializationContext ctxt, Object bean)

Method called after JSON Object closes, and has to ensure that all external type ids have been handled.

public Object
complete(JsonParser p, DeserializationContext ctxt, PropertyValueBuffer buffer, PropertyBasedCreator creator)

Variant called when creation of the POJO involves buffering of creator properties as well as property-based creator.

public boolean

Returns:

True, if the given property was properly handled
handlePropertyValue
(JsonParser p, DeserializationContext ctxt, String propName, Object bean)

Method called to ask handler to handle value of given property, at point where parser points to the first token of the value.

public boolean
handleTypePropertyValue(JsonParser p, DeserializationContext ctxt, String propName, Object bean)

Method called to see if given property/value pair is an external type id; and if so handle it.

public ExternalTypeHandler
start()

Method called to start collection process by creating non-blueprint instances.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_beanTypeback to summary
private final JavaType _beanType
_nameToPropertyIndexback to summary
private final Map<String, Object> _nameToPropertyIndex

Mapping from external property ids to one or more indexes; in most cases single index as Integer, but occasionally same name maps to multiple ones: if so, List<Integer>.

_propertiesback to summary
private final ExternalTypeHandler.ExtTypedProperty[] _properties
_tokensback to summary
private final TokenBuffer[] _tokens
_typeIdsback to summary
private final String[] _typeIds

Constructor Detail

ExternalTypeHandlerback to summary
protected ExternalTypeHandler(JavaType beanType, ExternalTypeHandler.ExtTypedProperty[] properties, Map<String, Object> nameToPropertyIndex, String[] typeIds, TokenBuffer[] tokens)
ExternalTypeHandlerback to summary
protected ExternalTypeHandler(ExternalTypeHandler h)

Method Detail

_deserializeback to summary
protected final Object _deserialize(JsonParser p, DeserializationContext ctxt, int index, String typeId) throws IOException
Annotations
@SuppressWarnings:resource
_deserializeAndSetback to summary
protected final void _deserializeAndSet(JsonParser p, DeserializationContext ctxt, Object bean, int index, String typeId) throws IOException
Annotations
@SuppressWarnings:resource
_deserializeMissingTokenback to summary
protected final Object _deserializeMissingToken(JsonParser p, DeserializationContext ctxt, int index, String typeId) throws IOException
Annotations
@SuppressWarnings:resource
_handleTypePropertyValueback to summary
private final boolean _handleTypePropertyValue(JsonParser p, DeserializationContext ctxt, String propName, Object bean, String typeId, int index) throws IOException
builderback to summary
public static ExternalTypeHandler.Builder builder(JavaType beanType)
Since
2.9
completeback to summary
public Object complete(JsonParser p, DeserializationContext ctxt, Object bean) throws IOException

Method called after JSON Object closes, and has to ensure that all external type ids have been handled.

Annotations
@SuppressWarnings:resource
completeback to summary
public Object complete(JsonParser p, DeserializationContext ctxt, PropertyValueBuffer buffer, PropertyBasedCreator creator) throws IOException

Variant called when creation of the POJO involves buffering of creator properties as well as property-based creator.

handlePropertyValueback to summary
public boolean handlePropertyValue(JsonParser p, DeserializationContext ctxt, String propName, Object bean) throws IOException

Method called to ask handler to handle value of given property, at point where parser points to the first token of the value. Handling can mean either resolving type id it contains (if it matches type property name), or by buffering the value for further use.

Returns:boolean

True, if the given property was properly handled

Annotations
@SuppressWarnings:unchecked
handleTypePropertyValueback to summary
public boolean handleTypePropertyValue(JsonParser p, DeserializationContext ctxt, String propName, Object bean) throws IOException

Method called to see if given property/value pair is an external type id; and if so handle it. This is only to be called in case containing POJO has similarly named property as the external type id AND value is of scalar type: otherwise handlePropertyValue should be called instead.

Annotations
@SuppressWarnings:unchecked
startback to summary
public ExternalTypeHandler start()

Method called to start collection process by creating non-blueprint instances.

com.fasterxml.jackson.databind.deser.impl back to summary

public Class ExternalTypeHandler.Builder

extends Object
Class Inheritance
  • java.lang.Object
  • com.fasterxml.jackson.databind.deser.impl.ExternalTypeHandler.Builder

Field Summary

Modifier and TypeField and Description
private final JavaType
private final Map<String, Object>
private final List<ExternalTypeHandler.ExtTypedProperty>

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
private void
public void
public ExternalTypeHandler
build(BeanPropertyMap otherProps)

Method called after all external properties have been assigned, to further link property with polymorphic value with possible property for type id itself.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_beanTypeback to summary
private final JavaType _beanType
_nameToPropertyIndexback to summary
private final Map<String, Object> _nameToPropertyIndex
_propertiesback to summary
private final List<ExternalTypeHandler.ExtTypedProperty> _properties

Constructor Detail

Builderback to summary
protected Builder(JavaType t)

Method Detail

_addPropertyIndexback to summary
private void _addPropertyIndex(String name, Integer index)
addExternalback to summary
public void addExternal(SettableBeanProperty property, TypeDeserializer typeDeser)
buildback to summary
public ExternalTypeHandler build(BeanPropertyMap otherProps)

Method called after all external properties have been assigned, to further link property with polymorphic value with possible property for type id itself. This is needed to support type ids as Creator properties.

Since
2.8
com.fasterxml.jackson.databind.deser.impl back to summary

private final Class ExternalTypeHandler.ExtTypedProperty

extends Object
Class Inheritance
  • java.lang.Object
  • com.fasterxml.jackson.databind.deser.impl.ExternalTypeHandler.ExtTypedProperty

Field Summary

Modifier and TypeField and Description
private final SettableBeanProperty
private final TypeDeserializer
private SettableBeanProperty
private final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
getDefaultTypeId()

Specialized called when we need to expose type id of `defaultImpl` when serializing: we may need to expose it for assignment to a property, or it may be requested as visible for some other reason.

public SettableBeanProperty
public SettableBeanProperty
public String
public boolean
public boolean
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_propertyback to summary
private final SettableBeanProperty _property
_typeDeserializerback to summary
private final TypeDeserializer _typeDeserializer
_typePropertyback to summary
private SettableBeanProperty _typeProperty
Since
2.8
_typePropertyNameback to summary
private final String _typePropertyName

Constructor Detail

ExtTypedPropertyback to summary
public ExtTypedProperty(SettableBeanProperty property, TypeDeserializer typeDeser)

Method Detail

getDefaultTypeIdback to summary
public String getDefaultTypeId()

Specialized called when we need to expose type id of `defaultImpl` when serializing: we may need to expose it for assignment to a property, or it may be requested as visible for some other reason.

getPropertyback to summary
public SettableBeanProperty getProperty()
getTypePropertyback to summary
public SettableBeanProperty getTypeProperty()
Since
2.8
getTypePropertyNameback to summary
public String getTypePropertyName()
hasDefaultTypeback to summary
public boolean hasDefaultType()
hasTypePropertyNameback to summary
public boolean hasTypePropertyName(String n)
linkTypePropertyback to summary
public void linkTypeProperty(SettableBeanProperty p)
Since
2.8