Class BeanDeserializerBuilder
- java.lang.Object
-
- com.fasterxml.jackson.databind.deser.BeanDeserializerBuilder
-
public class BeanDeserializerBuilder extends Object
Builder class used for aggregating deserialization information about a POJO, in order to build aJsonDeserializerfor deserializing instances.
-
-
Field Summary
Fields Modifier and Type Field Description protected SettableAnyProperty_anySetterFallback setter used for handling any properties that are not mapped to regular setters.protected HashMap<String,SettableBeanProperty>_backRefPropertiesBack-reference properties this bean contains (if any)protected BeanDescription_beanDescIntrospected information about POJO for deserializer to handleprotected JsonPOJOBuilder.Value_builderConfigIn addition, Builder may have additional configurationprotected AnnotatedMethod_buildMethodWhen creating Builder-based deserializers, this indicates method to call on builder to finalize value.protected DeserializationConfig_configprotected DeserializationContext_contextprotected HashSet<String>_ignorablePropsSet of names of properties that are recognized but are to be ignored for deserialization purposes (meaning no exception is thrown, value is just skipped).protected boolean_ignoreAllUnknownFlag that can be set to ignore and skip unknown properties.protected List<ValueInjector>_injectablesValue injectors for deserializationprotected ObjectIdReader_objectIdReaderHandler for Object Id values, if Object Ids are enabled for the bean type.protected Map<String,SettableBeanProperty>_propertiesProperties to deserialize collected so far.protected ValueInstantiator_valueInstantiatorObject that will handle value instantiation for the bean type.
-
Constructor Summary
Constructors Modifier Constructor Description BeanDeserializerBuilder(BeanDescription beanDesc, DeserializationContext ctxt)protectedBeanDeserializerBuilder(BeanDeserializerBuilder src)Copy constructor for sub-classes to use, when constructing custom builder instances
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,List<PropertyName>>_collectAliases(Collection<SettableBeanProperty> props)protected void_fixAccess(Collection<SettableBeanProperty> mainProps)voidaddBackReferenceProperty(String referenceName, SettableBeanProperty prop)Method called to add a property that represents so-called back reference; reference that "points back" to object that has forward reference to currently built bean.voidaddCreatorProperty(SettableBeanProperty prop)Method called by deserializer factory, when a "creator property" (something that is passed via constructor- or factory method argument; instead of setter or field).voidaddIgnorable(String propName)Method that will add property name as one of properties that can be ignored if not recognized.voidaddInjectable(PropertyName propName, JavaType propType, Annotations contextAnnotations, AnnotatedMember member, Object valueId)voidaddOrReplaceProperty(SettableBeanProperty prop, boolean allowOverride)Method for adding a new property or replacing a property.voidaddProperty(SettableBeanProperty prop)Method to add a property setter.JsonDeserializer<?>build()Method for constructing aBeanDeserializer, given all information collected.AbstractDeserializerbuildAbstract()Alternate build method used when we must be using some form of abstract resolution, usually by using addition Type Id ("polymorphic deserialization")JsonDeserializer<?>buildBuilderBased(JavaType valueType, String expBuildMethodName)Method for constructing a specialized deserializer that uses additional external Builder object during data binding.protected JsonDeserializer<?>createBuilderBasedDeserializer(JavaType valueType, BeanPropertyMap propertyMap, boolean anyViews)Extension point for overriding the actual creation of the builder deserializer.SettableBeanPropertyfindProperty(PropertyName propertyName)SettableAnyPropertygetAnySetter()JsonPOJOBuilder.ValuegetBuilderConfig()AnnotatedMethodgetBuildMethod()List<ValueInjector>getInjectables()ObjectIdReadergetObjectIdReader()Iterator<SettableBeanProperty>getProperties()Method that allows accessing all properties that this builder currently contains.ValueInstantiatorgetValueInstantiator()booleanhasIgnorable(String name)booleanhasProperty(PropertyName propertyName)SettableBeanPropertyremoveProperty(PropertyName name)voidsetAnySetter(SettableAnyProperty s)voidsetIgnoreUnknownProperties(boolean ignore)voidsetObjectIdReader(ObjectIdReader r)voidsetPOJOBuilder(AnnotatedMethod buildMethod, JsonPOJOBuilder.Value config)voidsetValueInstantiator(ValueInstantiator inst)
-
-
-
Field Detail
-
_config
protected final DeserializationConfig _config
-
_context
protected final DeserializationContext _context
- Since:
- 2.9
-
_beanDesc
protected final BeanDescription _beanDesc
Introspected information about POJO for deserializer to handle
-
_properties
protected final Map<String,SettableBeanProperty> _properties
Properties to deserialize collected so far.
-
_injectables
protected List<ValueInjector> _injectables
Value injectors for deserialization
-
_backRefProperties
protected HashMap<String,SettableBeanProperty> _backRefProperties
Back-reference properties this bean contains (if any)
-
_ignorableProps
protected HashSet<String> _ignorableProps
Set of names of properties that are recognized but are to be ignored for deserialization purposes (meaning no exception is thrown, value is just skipped).
-
_valueInstantiator
protected ValueInstantiator _valueInstantiator
Object that will handle value instantiation for the bean type.
-
_objectIdReader
protected ObjectIdReader _objectIdReader
Handler for Object Id values, if Object Ids are enabled for the bean type.
-
_anySetter
protected SettableAnyProperty _anySetter
Fallback setter used for handling any properties that are not mapped to regular setters. If setter is not null, it will be called once for each such property.
-
_ignoreAllUnknown
protected boolean _ignoreAllUnknown
Flag that can be set to ignore and skip unknown properties. If set, will not throw an exception for unknown properties.
-
_buildMethod
protected AnnotatedMethod _buildMethod
When creating Builder-based deserializers, this indicates method to call on builder to finalize value.
-
_builderConfig
protected JsonPOJOBuilder.Value _builderConfig
In addition, Builder may have additional configuration
-
-
Constructor Detail
-
BeanDeserializerBuilder
public BeanDeserializerBuilder(BeanDescription beanDesc, DeserializationContext ctxt)
-
BeanDeserializerBuilder
protected BeanDeserializerBuilder(BeanDeserializerBuilder src)
Copy constructor for sub-classes to use, when constructing custom builder instances
-
-
Method Detail
-
addOrReplaceProperty
public void addOrReplaceProperty(SettableBeanProperty prop, boolean allowOverride)
Method for adding a new property or replacing a property.
-
addProperty
public void addProperty(SettableBeanProperty prop)
Method to add a property setter. Will ensure that there is no unexpected override; if one is found will throw aIllegalArgumentException.
-
addBackReferenceProperty
public void addBackReferenceProperty(String referenceName, SettableBeanProperty prop)
Method called to add a property that represents so-called back reference; reference that "points back" to object that has forward reference to currently built bean.
-
addInjectable
public void addInjectable(PropertyName propName, JavaType propType, Annotations contextAnnotations, AnnotatedMember member, Object valueId)
-
addIgnorable
public void addIgnorable(String propName)
Method that will add property name as one of properties that can be ignored if not recognized.
-
addCreatorProperty
public void addCreatorProperty(SettableBeanProperty prop)
Method called by deserializer factory, when a "creator property" (something that is passed via constructor- or factory method argument; instead of setter or field).Default implementation does not do anything; we may need to revisit this decision if these properties need to be available through accessors. For now, however, we just have to ensure that we don't try to resolve types that masked setter/field has (see [JACKSON-700] for details).
-
setAnySetter
public void setAnySetter(SettableAnyProperty s)
-
setIgnoreUnknownProperties
public void setIgnoreUnknownProperties(boolean ignore)
-
setValueInstantiator
public void setValueInstantiator(ValueInstantiator inst)
-
setObjectIdReader
public void setObjectIdReader(ObjectIdReader r)
-
setPOJOBuilder
public void setPOJOBuilder(AnnotatedMethod buildMethod, JsonPOJOBuilder.Value config)
-
getProperties
public Iterator<SettableBeanProperty> getProperties()
Method that allows accessing all properties that this builder currently contains.Note that properties are returned in order that properties are ordered (explictly, or by rule), which is the serialization order.
-
findProperty
public SettableBeanProperty findProperty(PropertyName propertyName)
-
hasProperty
public boolean hasProperty(PropertyName propertyName)
-
removeProperty
public SettableBeanProperty removeProperty(PropertyName name)
-
getAnySetter
public SettableAnyProperty getAnySetter()
-
getValueInstantiator
public ValueInstantiator getValueInstantiator()
-
getInjectables
public List<ValueInjector> getInjectables()
-
getObjectIdReader
public ObjectIdReader getObjectIdReader()
-
getBuildMethod
public AnnotatedMethod getBuildMethod()
-
getBuilderConfig
public JsonPOJOBuilder.Value getBuilderConfig()
-
hasIgnorable
public boolean hasIgnorable(String name)
- Since:
- 2.9.4
-
build
public JsonDeserializer<?> build()
Method for constructing aBeanDeserializer, given all information collected.
-
buildAbstract
public AbstractDeserializer buildAbstract()
Alternate build method used when we must be using some form of abstract resolution, usually by using addition Type Id ("polymorphic deserialization")- Since:
- 2.0
-
buildBuilderBased
public JsonDeserializer<?> buildBuilderBased(JavaType valueType, String expBuildMethodName) throws JsonMappingException
Method for constructing a specialized deserializer that uses additional external Builder object during data binding.- Throws:
JsonMappingException
-
createBuilderBasedDeserializer
protected JsonDeserializer<?> createBuilderBasedDeserializer(JavaType valueType, BeanPropertyMap propertyMap, boolean anyViews)
Extension point for overriding the actual creation of the builder deserializer.- Since:
- 2.10.1 (officially in 2.10.0)
-
_fixAccess
protected void _fixAccess(Collection<SettableBeanProperty> mainProps)
-
_collectAliases
protected Map<String,List<PropertyName>> _collectAliases(Collection<SettableBeanProperty> props)
-
-