Class MergingSettableBeanProperty
- java.lang.Object
-
- com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase
-
- com.fasterxml.jackson.databind.deser.SettableBeanProperty
-
- com.fasterxml.jackson.databind.deser.SettableBeanProperty.Delegating
-
- com.fasterxml.jackson.databind.deser.impl.MergingSettableBeanProperty
-
- All Implemented Interfaces:
BeanProperty,Named,java.io.Serializable
public class MergingSettableBeanProperty extends SettableBeanProperty.Delegating
SettableBeanPropertyimplementation that will try to access value of the property first, and if non-null value found, pass that for update (usingJsonDeserializer.deserialize(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext, Object)) instead of constructing a new value. This is necessary to support "merging" properties.Note that there are many similarities to
SetterlessProperty, which predates this variant; and that one is even used in cases where there is no mutator available.- Since:
- 2.9
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.deser.SettableBeanProperty
SettableBeanProperty.Delegating
-
Nested classes/interfaces inherited from interface com.fasterxml.jackson.databind.BeanProperty
BeanProperty.Bogus, BeanProperty.Std
-
-
Field Summary
Fields Modifier and Type Field Description protected AnnotatedMember_accessorMember (field, method) used for accessing existing value.private static longserialVersionUID-
Fields inherited from class com.fasterxml.jackson.databind.deser.SettableBeanProperty.Delegating
delegate
-
Fields inherited from class com.fasterxml.jackson.databind.deser.SettableBeanProperty
_contextAnnotations, _managedReferenceName, _nullProvider, _objectIdInfo, _propertyIndex, _propName, _type, _valueDeserializer, _valueTypeDeserializer, _viewMatcher, _wrapperName, MISSING_VALUE_DESERIALIZER
-
Fields inherited from class com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase
_aliases, _metadata
-
Fields inherited from interface com.fasterxml.jackson.databind.BeanProperty
EMPTY_FORMAT, EMPTY_INCLUDE
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMergingSettableBeanProperty(MergingSettableBeanProperty src, SettableBeanProperty delegate)protectedMergingSettableBeanProperty(SettableBeanProperty delegate, AnnotatedMember accessor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MergingSettableBeanPropertyconstruct(SettableBeanProperty delegate, AnnotatedMember accessor)voiddeserializeAndSet(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt, java.lang.Object instance)Method called to deserialize appropriate value, given parser (and context), and set it using appropriate mechanism.java.lang.ObjectdeserializeSetAndReturn(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt, java.lang.Object instance)Alternative toSettableBeanProperty.deserializeAndSet(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext, java.lang.Object)that returns either return value of setter method called (if one is), or null to indicate that no return value is available.booleanisMerging()Whether this property requires merging of values (read-then-write)voidset(java.lang.Object instance, java.lang.Object value)Method called to assign given value to this property, on specified Object.java.lang.ObjectsetAndReturn(java.lang.Object instance, java.lang.Object value)Method called to assign given value to this property, on specified Object, and return whatever delegating accessor returned (if anything)protected SettableBeanPropertywithDelegate(SettableBeanProperty d)Method sub-classes must implement, to construct a new instance with given delegate.-
Methods inherited from class com.fasterxml.jackson.databind.deser.SettableBeanProperty.Delegating
_with, assignIndex, fixAccess, getAnnotation, getCreatorIndex, getDeclaringClass, getDelegate, getInjectableValueId, getManagedReferenceName, getMember, getObjectIdInfo, getPropertyIndex, getValueDeserializer, getValueTypeDeserializer, hasValueDeserializer, hasValueTypeDeserializer, hasViews, isInjectionOnly, visibleInView, withName, withNullProvider, withValueDeserializer
-
Methods inherited from class com.fasterxml.jackson.databind.deser.SettableBeanProperty
_throwAsIOE, _throwAsIOE, _throwAsIOE, _throwAsIOE, depositSchemaProperty, deserialize, deserializeWith, getContextAnnotation, getFullName, getInjectionDefinition, getName, getNullValueProvider, getType, getWrapperName, isIgnorable, markAsIgnorable, setManagedReferenceName, setObjectIdInfo, setViews, toString, unwrapped, withSimpleName
-
Methods inherited from class com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase
findAliases, findFormatOverrides, findPropertyFormat, findPropertyInclusion, getMetadata, isRequired, isVirtual
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
_accessor
protected final AnnotatedMember _accessor
Member (field, method) used for accessing existing value.
-
-
Constructor Detail
-
MergingSettableBeanProperty
protected MergingSettableBeanProperty(SettableBeanProperty delegate, AnnotatedMember accessor)
-
MergingSettableBeanProperty
protected MergingSettableBeanProperty(MergingSettableBeanProperty src, SettableBeanProperty delegate)
-
-
Method Detail
-
construct
public static MergingSettableBeanProperty construct(SettableBeanProperty delegate, AnnotatedMember accessor)
-
withDelegate
protected SettableBeanProperty withDelegate(SettableBeanProperty d)
Description copied from class:SettableBeanProperty.DelegatingMethod sub-classes must implement, to construct a new instance with given delegate.- Specified by:
withDelegatein classSettableBeanProperty.Delegating
-
isMerging
public boolean isMerging()
Description copied from class:SettableBeanPropertyWhether this property requires merging of values (read-then-write)- Overrides:
isMergingin classSettableBeanProperty
-
deserializeAndSet
public void deserializeAndSet(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt, java.lang.Object instance) throws java.io.IOExceptionDescription copied from class:SettableBeanPropertyMethod called to deserialize appropriate value, given parser (and context), and set it using appropriate mechanism. Pre-condition is that passed parser must point to the first token that should be consumed to produce the value (the only value for scalars, multiple for Objects and Arrays).- Overrides:
deserializeAndSetin classSettableBeanProperty.Delegating- Throws:
java.io.IOException
-
deserializeSetAndReturn
public java.lang.Object deserializeSetAndReturn(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt, java.lang.Object instance) throws java.io.IOExceptionDescription copied from class:SettableBeanPropertyAlternative toSettableBeanProperty.deserializeAndSet(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext, java.lang.Object)that returns either return value of setter method called (if one is), or null to indicate that no return value is available. Mostly used to support Builder style deserialization.- Overrides:
deserializeSetAndReturnin classSettableBeanProperty.Delegating- Throws:
java.io.IOException
-
set
public void set(java.lang.Object instance, java.lang.Object value) throws java.io.IOExceptionDescription copied from class:SettableBeanPropertyMethod called to assign given value to this property, on specified Object.Note: this is an optional operation, not supported by all implementations, creator-backed properties for example do not support this method.
- Overrides:
setin classSettableBeanProperty.Delegating- Throws:
java.io.IOException
-
setAndReturn
public java.lang.Object setAndReturn(java.lang.Object instance, java.lang.Object value) throws java.io.IOExceptionDescription copied from class:SettableBeanPropertyMethod called to assign given value to this property, on specified Object, and return whatever delegating accessor returned (if anything)Note: this is an optional operation, not supported by all implementations, creator-backed properties for example do not support this method.
- Overrides:
setAndReturnin classSettableBeanProperty.Delegating- Throws:
java.io.IOException
-
-