Top Description Fields Constructors Methods
tools.jackson.databind.deser.bean

public Class BuilderBasedDeserializer

extends BeanDeserializerBase
Class Inheritance
Imports
java.util.*, tools.jackson.core.*, tools.jackson.core.sym.PropertyNameMatcher, tools.jackson.databind.*, tools.jackson.databind.cfg.CoercionAction, tools.jackson.databind.deser.BeanDeserializerBuilder, .SettableBeanProperty, tools.jackson.databind.deser.impl.ExternalTypeHandler, .ObjectIdReader, .UnwrappedPropertyHandler, tools.jackson.databind.introspect.AnnotatedMethod, tools.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
private transient volatile NameTransformer
_currentlyTransforming

State marker we need in order to avoid infinite recursion for some cases (not very clean, alas, but has to do for now)

protected SettableBeanProperty[]
protected PropertyNameMatcher
protected final JavaType
_targetType

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

Inherited from tools.jackson.databind.deser.bean.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.Supplier beanDescRef, JavaType targetType, BeanPropertyMap properties, Map<String, SettableBeanProperty> backRefs, Set<String> ignorableProps, boolean ignoreAllUnknown, boolean hasViews)

Constructor used by BeanDeserializerBuilder.

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

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
BuilderBasedDeserializer(BuilderBasedDeserializer src, UnwrappedPropertyHandler unwrapHandler, PropertyBasedCreator pbCreator, BeanPropertyMap renamedProperties, boolean ignoreAllUnknown)

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 tools.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 tools.jackson.databind.deser.bean.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 Object
_handleUnexpectedWithin(JsonParser p, DeserializationContext ctxt, Object beanOrBuilder)

Method called if an unexpected token (other then FIELD_NAME) is found after POJO has been instantiated and partially bound.

private final Object
_vanillaDeserialize(JsonParser p, DeserializationContext ctxt)

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

protected BeanDeserializerBase
asArrayDeserializer()

Implements abstract tools.jackson.databind.deser.bean.BeanDeserializerBase.asArrayDeserializer.

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

public Object
deserialize(JsonParser p, DeserializationContext ctxt)

Implements abstract tools.jackson.databind.ValueDeserializer.deserialize.

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

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

Overrides tools.jackson.databind.ValueDeserializer.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 tools.jackson.databind.deser.bean.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
protected void
public Boolean
supportsUpdate(DeserializationConfig config)

Overrides tools.jackson.databind.deser.bean.BeanDeserializerBase.supportsUpdate.

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

public ValueDeserializer<Object>
unwrappingDeserializer(DeserializationContext ctxt, NameTransformer transformer)

Implements abstract tools.jackson.databind.deser.bean.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.

public BeanDeserializerBase
withBeanProperties(BeanPropertyMap props)

Overrides tools.jackson.databind.deser.bean.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 tools.jackson.databind.deser.bean.BeanDeserializerBase:
_convertObjectId_delegateDeserializer_delegateDeserializer_findConvertingDeserializer_findPropertyUnwrapper_findSubclassDeserializer_getSetterInfo_handleByNameInclusion_handleTypedObjectId_replaceProperty_resolvedObjectIdProperty_resolveInnerClassValuedProperty_resolveManagedReferenceProperty_resolveMergeAndNullSettingscreateContextualcreatorPropertiesdeserializeFromBooleandeserializeFromDoubledeserializeFromEmbeddeddeserializeFromNumberdeserializeFromObjectIddeserializeFromObjectUsingNonDefaultdeserializeFromStringdeserializeWithObjectIddeserializeWithTypefindBackReferencefindPropertyfindPropertyfindPropertygetEmptyAccessPatterngetEmptyValuegetKnownPropertyNamesgetNullAccessPatterngetObjectIdReadergetPropertyCountgetValueInstantiatorgetValueTypehandledTypehandleIgnoredPropertyhandlePolymorphichandleUnknownPropertieshandleUnknownPropertyhandleUnknownVanillahasPropertyhasViewsinjectValuesisCachableisCaseInsensitivelogicalTypepropertiesresolvewrapAndThrowwrapInstantiationProblem

Field Detail

_buildMethodback to summary
protected final AnnotatedMethod _buildMethod
_currentlyTransformingback to summary
private transient volatile NameTransformer _currentlyTransforming

State marker we need in order to avoid infinite recursion for some cases (not very clean, alas, but has to do for now)

_propertiesByIndexback to summary
protected SettableBeanProperty[] _propertiesByIndex
_propertyNameMatcherback to summary
protected PropertyNameMatcher _propertyNameMatcher
_targetTypeback to summary
protected final JavaType _targetType

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

Constructor Detail

BuilderBasedDeserializerback to summary
public BuilderBasedDeserializer(BeanDeserializerBuilder builder, BeanDescription.Supplier beanDescRef, 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.Supplier beanDescRef, JavaType targetType, BeanPropertyMap properties, Map<String, SettableBeanProperty> backRefs, Set<String> ignorableProps, boolean ignoreAllUnknown, Set<String> includableProps, boolean hasViews)
Since
2.12
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, UnwrappedPropertyHandler unwrapHandler, PropertyBasedCreator pbCreator, BeanPropertyMap renamedProperties, boolean ignoreAllUnknown)
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 JacksonException
_deserializeFromArrayback to summary
protected Object _deserializeFromArray(JsonParser p, DeserializationContext ctxt) throws JacksonException

Overrides tools.jackson.databind.deser.std.StdDeserializer._deserializeFromArray.

Doc from tools.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 JacksonException

Implements abstract tools.jackson.databind.deser.bean.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
_handleUnexpectedWithinback to summary
protected Object _handleUnexpectedWithin(JsonParser p, DeserializationContext ctxt, Object beanOrBuilder) throws JacksonException

Method called if an unexpected token (other then FIELD_NAME) is found after POJO has been instantiated and partially bound.

Since
3.0
_vanillaDeserializeback to summary
private final Object _vanillaDeserialize(JsonParser p, DeserializationContext ctxt) throws JacksonException

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

asArrayDeserializerback to summary
protected BeanDeserializerBase asArrayDeserializer()

Implements abstract tools.jackson.databind.deser.bean.BeanDeserializerBase.asArrayDeserializer.

Doc from tools.jackson.databind.deser.bean.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 JacksonException

Implements abstract tools.jackson.databind.ValueDeserializer.deserialize.

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

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

Overrides tools.jackson.databind.ValueDeserializer.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 JacksonException

Implements abstract tools.jackson.databind.deser.bean.BeanDeserializerBase.deserializeFromObject.

General version used when handling needs more advanced features.

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

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 JacksonException
deserializeWithViewback to summary
protected final Object deserializeWithView(JsonParser p, DeserializationContext ctxt, Object bean, Class<?> activeView) throws JacksonException
finishBuildback to summary
protected Object finishBuild(DeserializationContext ctxt, Object builder) throws JacksonException
initNameMatcherback to summary
protected void initNameMatcher(DeserializationContext ctxt)

Implements abstract tools.jackson.databind.deser.bean.BeanDeserializerBase.initNameMatcher.

Annotations
@Override
supportsUpdateback to summary
public Boolean supportsUpdate(DeserializationConfig config)

Overrides tools.jackson.databind.deser.bean.BeanDeserializerBase.supportsUpdate.

Doc from tools.jackson.databind.ValueDeserializer.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 ValueDeserializer<Object> unwrappingDeserializer(DeserializationContext ctxt, NameTransformer transformer)

Implements abstract tools.jackson.databind.deser.bean.BeanDeserializerBase.unwrappingDeserializer.

Doc from tools.jackson.databind.ValueDeserializer.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
withBeanPropertiesback to summary
public BeanDeserializerBase withBeanProperties(BeanPropertyMap props)

Overrides tools.jackson.databind.deser.bean.BeanDeserializerBase.withBeanProperties.

Doc from tools.jackson.databind.deser.bean.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 tools.jackson.databind.deser.bean.BeanDeserializerBase.withByNameInclusion.

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

Implements abstract tools.jackson.databind.deser.bean.BeanDeserializerBase.withIgnoreAllUnknown.

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

Implements abstract tools.jackson.databind.deser.bean.BeanDeserializerBase.withObjectIdReader.

Annotations
@Override