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

public Class BuilderBasedDeserializer

extends BeanDeserializerBase
Class Inheritance
Imports
java.io.IOException, java.util.*, com.fasterxml.jackson.core.*, com.fasterxml.jackson.databind.*, com.fasterxml.jackson.databind.cfg.CoercionAction, com.fasterxml.jackson.databind.deser.impl.*, com.fasterxml.jackson.databind.introspect.AnnotatedMethod, com.fasterxml.jackson.databind.util.ClassUtil, .IgnorePropertiesUtil, .NameTransformer, .TokenBuffer

Class that handles deserialization using a separate Builder class, which is used for data binding and produces actual deserialized value at the end of data binding.

Note on implementation: much of code has been copied from BeanDeserializer; there may be opportunities to refactor this in future.

Field Summary

Modifier and TypeField and Description
protected final AnnotatedMethod
protected final JavaType
_targetType

Type that the builder will produce, target type; as opposed to `handledType()` which refers to Builder class.

private static final long
Inherited from com.fasterxml.jackson.databind.deser.BeanDeserializerBase:
_anySetter_arrayDelegateDeserializer_backRefs_beanProperties_beanType_delegateDeserializer_externalTypeIdHandler_ignorableProps_ignoreAllUnknown_includableProps_injectables_needViewProcesing_nonStandardCreation_objectIdReader_propertyBasedCreator_serializationShape_subDeserializers_unwrappedPropertyHandler_valueInstantiator_vanillaProcessingTEMP_PROPERTY_NAME

Constructor Summary

AccessConstructor and Description
public
BuilderBasedDeserializer(BeanDeserializerBuilder builder, BeanDescription beanDesc, JavaType targetType, BeanPropertyMap properties, Map<String, SettableBeanProperty> backRefs, Set<String> ignorableProps, boolean ignoreAllUnknown, boolean hasViews)

Constructor used by BeanDeserializerBuilder.

public
BuilderBasedDeserializer(BeanDeserializerBuilder builder, BeanDescription beanDesc, JavaType targetType, BeanPropertyMap properties, Map<String, SettableBeanProperty> backRefs, Set<String> ignorableProps, boolean ignoreAllUnknown, Set<String> includableProps, boolean hasViews)

public
BuilderBasedDeserializer(BeanDeserializerBuilder builder, BeanDescription beanDesc, BeanPropertyMap properties, Map<String, SettableBeanProperty> backRefs, Set<String> ignorableProps, boolean ignoreAllUnknown, boolean hasViews)
Deprecated Since 2.9

protected
BuilderBasedDeserializer(BuilderBasedDeserializer src)

Copy-constructor that can be used by sub-classes to allow copy-on-write styling copying of settings of an existing instance.

protected
BuilderBasedDeserializer(BuilderBasedDeserializer src, boolean ignoreAllUnknown)

protected
public
public
public
BuilderBasedDeserializer(BuilderBasedDeserializer src, Set<String> ignorableProps, Set<String> includableProps)

public

Method Summary

Modifier and TypeMethod and Description
protected final Object
protected Object
_deserializeFromArray(JsonParser p, DeserializationContext ctxt)

Overrides com.fasterxml.jackson.databind.deser.std.StdDeserializer._deserializeFromArray.

Helper method that allows easy support for array-related coercion features: checks for either empty array, or single-value array-wrapped value (if coercion enabled by CoercionConfigs (since 2.12), and either reports an exception (if no coercion allowed), or returns appropriate result value using coercion mechanism indicated.

protected Object

Returns:

Builder instance constructed
_deserializeUsingPropertyBased
(final JsonParser p, final DeserializationContext ctxt)

Implements abstract com.fasterxml.jackson.databind.deser.BeanDeserializerBase._deserializeUsingPropertyBased.

Method called to deserialize bean using "property-based creator": this means that a non-default constructor or factory method is called, and then possibly other setters.

protected BeanDeserializerBase
asArrayDeserializer()

Implements abstract com.fasterxml.jackson.databind.deser.BeanDeserializerBase.asArrayDeserializer.

Fluent factory for creating a variant that can handle POJO output as a JSON Array.

public Object
deserialize(JsonParser
Parser used for reading JSON content
p
,
DeserializationContext
Context that can be used to access information about this deserialization activity.
ctxt
)

Implements abstract com.fasterxml.jackson.databind.JsonDeserializer.deserialize.

Main deserialization method for bean-based objects (POJOs).

public Object
deserialize(JsonParser p, DeserializationContext ctxt, Object value)

Overrides com.fasterxml.jackson.databind.JsonDeserializer.deserialize.

Secondary deserialization method, called in cases where POJO instance is created as part of deserialization, potentially after collecting some or all of the properties to set.

public Object
deserializeFromObject(JsonParser p, DeserializationContext ctxt)

Implements abstract com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObject.

General version used when handling needs more advanced features.

protected Object
protected Object
protected Object
protected Object
protected Object
deserializeWithUnwrapped(JsonParser p, DeserializationContext ctxt)

Method called when there are declared "unwrapped" properties which need special handling

protected Object
protected final Object
protected Object
public Boolean
supportsUpdate(DeserializationConfig config)

Overrides com.fasterxml.jackson.databind.deser.BeanDeserializerBase.supportsUpdate.

Introspection method that may be called to see whether deserializer supports update of an existing value (aka "merging") or not.

public JsonDeserializer<Object>
unwrappingDeserializer(NameTransformer unwrapper)

Implements abstract com.fasterxml.jackson.databind.deser.BeanDeserializerBase.unwrappingDeserializer.

Method that will return deserializer instance that is able to handle "unwrapped" value instances If no unwrapped instance can be constructed, will simply return this object as-is.

private final Object
vanillaDeserialize(JsonParser p, DeserializationContext ctxt, JsonToken t)

Streamlined version that is only used when no "special" features are enabled.

public BeanDeserializerBase
withBeanProperties(BeanPropertyMap props)

Overrides com.fasterxml.jackson.databind.deser.BeanDeserializerBase.withBeanProperties.

Mutant factory method that custom sub-classes must override; not left as abstract to prevent more drastic backwards compatibility problems.

public BeanDeserializerBase
public BeanDeserializerBase
public BeanDeserializerBase
Inherited from com.fasterxml.jackson.databind.deser.BeanDeserializerBase:
_convertObjectId_delegateDeserializer_findPropertyUnwrapper_findSubclassDeserializer_handleByNameInclusion_handleTypedObjectId_replaceProperty_resolvedObjectIdProperty_resolveInnerClassValuedProperty_resolveManagedReferenceProperty_resolveMergeAndNullSettingscreateContextualcreatorPropertiesdeserializeFromArraydeserializeFromBooleandeserializeFromDoubledeserializeFromEmbeddeddeserializeFromNumberdeserializeFromObjectIddeserializeFromObjectUsingNonDefaultdeserializeFromStringdeserializeWithObjectIddeserializeWithTypefindBackReferencefindConvertingDeserializerfindPropertyfindPropertyfindPropertygetBeanClassgetEmptyAccessPatterngetEmptyValuegetKnownPropertyNamesgetNullAccessPatterngetObjectIdReadergetPropertyCountgetValueInstantiatorgetValueTypehandledTypehandleIgnoredPropertyhandlePolymorphichandlePolymorphichandleUnknownPropertieshandleUnknownPropertyhandleUnknownVanillahasPropertyhasViewsinjectValuesisCachableisCaseInsensitivelogicalTypepropertiesreplacePropertyresolvewithIgnorablePropertieswrapAndThrowwrapInstantiationProblem

Field Detail

_buildMethodback to summary
protected final AnnotatedMethod _buildMethod
_targetTypeback to summary
protected final JavaType _targetType

Type that the builder will produce, target type; as opposed to `handledType()` which refers to Builder class.

Since
2.9
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.databind.deser.BeanDeserializerBase.serialVersionUID.

Constructor Detail

BuilderBasedDeserializerback to summary
public BuilderBasedDeserializer(BeanDeserializerBuilder builder, BeanDescription beanDesc, JavaType targetType, BeanPropertyMap properties, Map<String, SettableBeanProperty> backRefs, Set<String> ignorableProps, boolean ignoreAllUnknown, boolean hasViews)

Constructor used by BeanDeserializerBuilder.

BuilderBasedDeserializerback to summary
public BuilderBasedDeserializer(BeanDeserializerBuilder builder, BeanDescription beanDesc, JavaType targetType, BeanPropertyMap properties, Map<String, SettableBeanProperty> backRefs, Set<String> ignorableProps, boolean ignoreAllUnknown, Set<String> includableProps, boolean hasViews)
Since
2.12
BuilderBasedDeserializerback to summary
public BuilderBasedDeserializer(BeanDeserializerBuilder builder, BeanDescription beanDesc, BeanPropertyMap properties, Map<String, SettableBeanProperty> backRefs, Set<String> ignorableProps, boolean ignoreAllUnknown, boolean hasViews)

Deprecated

Since 2.9

Annotations
@Deprecated
BuilderBasedDeserializerback to summary
protected BuilderBasedDeserializer(BuilderBasedDeserializer src)

Copy-constructor that can be used by sub-classes to allow copy-on-write styling copying of settings of an existing instance.

BuilderBasedDeserializerback to summary
protected BuilderBasedDeserializer(BuilderBasedDeserializer src, boolean ignoreAllUnknown)
BuilderBasedDeserializerback to summary
protected BuilderBasedDeserializer(BuilderBasedDeserializer src, NameTransformer unwrapper)
BuilderBasedDeserializerback to summary
public BuilderBasedDeserializer(BuilderBasedDeserializer src, ObjectIdReader oir)
BuilderBasedDeserializerback to summary
public BuilderBasedDeserializer(BuilderBasedDeserializer src, Set<String> ignorableProps)
BuilderBasedDeserializerback to summary
public BuilderBasedDeserializer(BuilderBasedDeserializer src, Set<String> ignorableProps, Set<String> includableProps)
BuilderBasedDeserializerback to summary
public BuilderBasedDeserializer(BuilderBasedDeserializer src, BeanPropertyMap props)

Method Detail

_deserializeback to summary
protected final Object _deserialize(JsonParser p, DeserializationContext ctxt, Object builder) throws IOException
_deserializeFromArrayback to summary
protected Object _deserializeFromArray(JsonParser p, DeserializationContext ctxt) throws IOException

Overrides com.fasterxml.jackson.databind.deser.std.StdDeserializer._deserializeFromArray.

Doc from com.fasterxml.jackson.databind.deser.std.StdDeserializer._deserializeFromArray.

Helper method that allows easy support for array-related coercion features: checks for either empty array, or single-value array-wrapped value (if coercion enabled by CoercionConfigs (since 2.12), and either reports an exception (if no coercion allowed), or returns appropriate result value using coercion mechanism indicated.

This method should NOT be called if Array representation is explicitly supported for type: it should only be called in case it is otherwise unrecognized.

Note

in case of unwrapped single element, will handle actual decoding by calling _deserializeWrappedValue, which by default calls deserialize(JsonParser, DeserializationContext).

Annotations
@Override
_deserializeUsingPropertyBasedback to summary
protected Object _deserializeUsingPropertyBased(final JsonParser p, final DeserializationContext ctxt) throws IOException

Implements abstract com.fasterxml.jackson.databind.deser.BeanDeserializerBase._deserializeUsingPropertyBased.

Method called to deserialize bean using "property-based creator": this means that a non-default constructor or factory method is called, and then possibly other setters. The trick is that values for creator method need to be buffered, first; and due to non-guaranteed ordering possibly some other properties as well.

Returns:Object

Builder instance constructed

Annotations
@Override
asArrayDeserializerback to summary
protected BeanDeserializerBase asArrayDeserializer()

Implements abstract com.fasterxml.jackson.databind.deser.BeanDeserializerBase.asArrayDeserializer.

Doc from com.fasterxml.jackson.databind.deser.BeanDeserializerBase.asArrayDeserializer.

Fluent factory for creating a variant that can handle POJO output as a JSON Array. Implementations may ignore this request if no such input is possible.

Annotations
@Override
deserializeback to summary
public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException

Implements abstract com.fasterxml.jackson.databind.JsonDeserializer.deserialize.

Main deserialization method for bean-based objects (POJOs).

Parameters
p:JsonParser

Doc from com.fasterxml.jackson.databind.JsonDeserializer.deserialize.

Parser used for reading JSON content

ctxt:DeserializationContext

Doc from com.fasterxml.jackson.databind.JsonDeserializer.deserialize.

Context that can be used to access information about this deserialization activity.

Returns:Object

Doc from com.fasterxml.jackson.databind.JsonDeserializer.deserialize.

Deserialized value

Annotations
@Override
deserializeback to summary
public Object deserialize(JsonParser p, DeserializationContext ctxt, Object value) throws IOException

Overrides com.fasterxml.jackson.databind.JsonDeserializer.deserialize.

Secondary deserialization method, called in cases where POJO instance is created as part of deserialization, potentially after collecting some or all of the properties to set.

Annotations
@Override
deserializeFromObjectback to summary
public Object deserializeFromObject(JsonParser p, DeserializationContext ctxt) throws IOException

Implements abstract com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObject.

General version used when handling needs more advanced features.

Annotations
@Override
deserializeUsingPropertyBasedWithExternalTypeIdback to summary
protected Object deserializeUsingPropertyBasedWithExternalTypeId(JsonParser p, DeserializationContext ctxt) throws IOException
deserializeUsingPropertyBasedWithUnwrappedback to summary
protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p, DeserializationContext ctxt) throws IOException
Annotations
@SuppressWarnings:resource
deserializeWithExternalTypeIdback to summary
protected Object deserializeWithExternalTypeId(JsonParser p, DeserializationContext ctxt) throws IOException
deserializeWithExternalTypeIdback to summary
protected Object deserializeWithExternalTypeId(JsonParser p, DeserializationContext ctxt, Object bean) throws IOException
deserializeWithUnwrappedback to summary
protected Object deserializeWithUnwrapped(JsonParser p, DeserializationContext ctxt) throws IOException

Method called when there are declared "unwrapped" properties which need special handling

Annotations
@SuppressWarnings:resource
deserializeWithUnwrappedback to summary
protected Object deserializeWithUnwrapped(JsonParser p, DeserializationContext ctxt, Object builder, TokenBuffer tokens) throws IOException
deserializeWithViewback to summary
protected final Object deserializeWithView(JsonParser p, DeserializationContext ctxt, Object bean, Class<?> activeView) throws IOException
finishBuildback to summary
protected Object finishBuild(DeserializationContext ctxt, Object builder) throws IOException
supportsUpdateback to summary
public Boolean supportsUpdate(DeserializationConfig config)

Overrides com.fasterxml.jackson.databind.deser.BeanDeserializerBase.supportsUpdate.

Doc from com.fasterxml.jackson.databind.JsonDeserializer.supportsUpdate.

Introspection method that may be called to see whether deserializer supports update of an existing value (aka "merging") or not. Return value should either be Boolean#FALSE if update is not supported at all (immutable values); Boolean#TRUE if update should usually work (regular POJOs, for example), or null if this is either not known, or may sometimes work.

Information gathered is typically used to either prevent merging update for property (either by skipping, if based on global defaults; or by exception during deserializer construction if explicit attempt made) if Boolean#FALSE returned, or inclusion if Boolean#TRUE is specified. If "unknown" case (null returned) behavior is to exclude property if global defaults used; or to allow if explicit per-type or property merging is defined.

Default implementation returns null to allow explicit per-type or per-property attempts.

Annotations
@Override
unwrappingDeserializerback to summary
public JsonDeserializer<Object> unwrappingDeserializer(NameTransformer unwrapper)

Implements abstract com.fasterxml.jackson.databind.deser.BeanDeserializerBase.unwrappingDeserializer.

Doc from com.fasterxml.jackson.databind.JsonDeserializer.unwrappingDeserializer.

Method that will return deserializer instance that is able to handle "unwrapped" value instances If no unwrapped instance can be constructed, will simply return this object as-is.

Default implementation just returns 'this' indicating that no unwrapped variant exists

Annotations
@Override
vanillaDeserializeback to summary
private final Object vanillaDeserialize(JsonParser p, DeserializationContext ctxt, JsonToken t) throws IOException

Streamlined version that is only used when no "special" features are enabled.

withBeanPropertiesback to summary
public BeanDeserializerBase withBeanProperties(BeanPropertyMap props)

Overrides com.fasterxml.jackson.databind.deser.BeanDeserializerBase.withBeanProperties.

Doc from com.fasterxml.jackson.databind.deser.BeanDeserializerBase.withBeanProperties.

Mutant factory method that custom sub-classes must override; not left as abstract to prevent more drastic backwards compatibility problems.

Annotations
@Override
withByNameInclusionback to summary
public BeanDeserializerBase withByNameInclusion(Set<String> ignorableProps, Set<String> includableProps)

Implements abstract com.fasterxml.jackson.databind.deser.BeanDeserializerBase.withByNameInclusion.

Annotations
@Override
withIgnoreAllUnknownback to summary
public BeanDeserializerBase withIgnoreAllUnknown(boolean ignoreUnknown)

Implements abstract com.fasterxml.jackson.databind.deser.BeanDeserializerBase.withIgnoreAllUnknown.

Annotations
@Override
withObjectIdReaderback to summary
public BeanDeserializerBase withObjectIdReader(ObjectIdReader oir)

Implements abstract com.fasterxml.jackson.databind.deser.BeanDeserializerBase.withObjectIdReader.

Annotations
@Override