Class SettableAnyProperty
- java.lang.Object
-
- com.fasterxml.jackson.databind.deser.SettableAnyProperty
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
SettableAnyProperty.JsonNodeFieldAnyProperty,SettableAnyProperty.JsonNodeParameterAnyProperty,SettableAnyProperty.MapFieldAnyProperty,SettableAnyProperty.MapParameterAnyProperty,SettableAnyProperty.MethodAnyProperty
public abstract class SettableAnyProperty extends java.lang.Object implements java.io.SerializableClass that represents a "wildcard" set method which can be used to generically set values of otherwise unmapped (aka "unknown") properties read from JSON content.Note: starting with 2.14, is
abstractclass with multiple concrete implementations- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSettableAnyProperty.AnySetterReferringprotected static classSettableAnyProperty.JsonNodeFieldAnyPropertyprotected static classSettableAnyProperty.JsonNodeParameterAnyProperty[databind#562] Allow @JsonAnySetter on Creator constructorprotected static classSettableAnyProperty.MapFieldAnyPropertyprotected static classSettableAnyProperty.MapParameterAnyProperty[databind#562] Allow @JsonAnySetter on Creator constructorprotected static classSettableAnyProperty.MethodAnyProperty
-
Field Summary
Fields Modifier and Type Field Description protected KeyDeserializer_keyDeserializerprotected BeanProperty_propertyMethod used for setting "any" properties, along with annotation information.protected AnnotatedMember_setterAnnotated variant is needed for JDK serialization onlyprotected boolean_setterIsFieldprotected JavaType_typeprotected JsonDeserializer<java.lang.Object>_valueDeserializerprotected TypeDeserializer_valueTypeDeserializerprivate static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description SettableAnyProperty(BeanProperty property, AnnotatedMember setter, JavaType type, KeyDeserializer keyDeser, JsonDeserializer<java.lang.Object> valueDeser, TypeDeserializer typeDeser)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void_set(java.lang.Object instance, java.lang.Object propName, java.lang.Object value)protected void_throwAsIOE(java.lang.Exception e, java.lang.Object propName, java.lang.Object value)static SettableAnyPropertyconstructForJsonNodeField(DeserializationContext ctxt, BeanProperty property, AnnotatedMember field, JavaType valueType, JsonDeserializer<java.lang.Object> valueDeser)static SettableAnyPropertyconstructForJsonNodeParameter(DeserializationContext ctxt, BeanProperty prop, AnnotatedMember mutator, JavaType valueType, JsonDeserializer<java.lang.Object> valueDeser, int parameterIndex)static SettableAnyPropertyconstructForMapField(DeserializationContext ctxt, BeanProperty property, AnnotatedMember field, JavaType valueType, KeyDeserializer keyDeser, JsonDeserializer<java.lang.Object> valueDeser, TypeDeserializer typeDeser)static SettableAnyPropertyconstructForMapParameter(DeserializationContext ctxt, BeanProperty property, AnnotatedMember field, JavaType valueType, KeyDeserializer keyDeser, JsonDeserializer<java.lang.Object> valueDeser, TypeDeserializer typeDeser, int parameterIndex)static SettableAnyPropertyconstructForMethod(DeserializationContext ctxt, BeanProperty property, AnnotatedMember field, JavaType valueType, KeyDeserializer keyDeser, JsonDeserializer<java.lang.Object> valueDeser, TypeDeserializer typeDeser)java.lang.ObjectcreateParameterObject()Create an instance of value to pass through Creator parameter.java.lang.Objectdeserialize(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt)voiddeserializeAndSet(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt, java.lang.Object instance, java.lang.String propName)Method called to deserialize appropriate value, given parser (and context), and set it using appropriate method (a setter method).voidfixAccess(DeserializationConfig config)private java.lang.StringgetClassName()intgetParameterIndex()Accessor for parameterIndex.BeanPropertygetProperty()java.lang.StringgetPropertyName()JavaTypegetType()booleanhasValueDeserializer()booleanisFieldType()Method called to check whether this property is fieldbooleanisSetterType()Method called to check whether this property is method(package private) java.lang.ObjectreadResolve()Need to define this to verify that we retain actual Method referencevoidset(java.lang.Object instance, java.lang.Object propName, java.lang.Object value)java.lang.StringtoString()abstract SettableAnyPropertywithValueDeserializer(JsonDeserializer<java.lang.Object> deser)
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
_property
protected final BeanProperty _property
Method used for setting "any" properties, along with annotation information. Retained to allow contextualization of any properties.
-
_setter
protected final AnnotatedMember _setter
Annotated variant is needed for JDK serialization only
-
_setterIsField
protected final boolean _setterIsField
-
_type
protected final JavaType _type
-
_valueDeserializer
protected JsonDeserializer<java.lang.Object> _valueDeserializer
-
_valueTypeDeserializer
protected final TypeDeserializer _valueTypeDeserializer
-
_keyDeserializer
protected final KeyDeserializer _keyDeserializer
- Since:
- 2.9
-
-
Constructor Detail
-
SettableAnyProperty
public SettableAnyProperty(BeanProperty property, AnnotatedMember setter, JavaType type, KeyDeserializer keyDeser, JsonDeserializer<java.lang.Object> valueDeser, TypeDeserializer typeDeser)
-
-
Method Detail
-
constructForMethod
public static SettableAnyProperty constructForMethod(DeserializationContext ctxt, BeanProperty property, AnnotatedMember field, JavaType valueType, KeyDeserializer keyDeser, JsonDeserializer<java.lang.Object> valueDeser, TypeDeserializer typeDeser)
- Since:
- 2.14
-
constructForMapField
public static SettableAnyProperty constructForMapField(DeserializationContext ctxt, BeanProperty property, AnnotatedMember field, JavaType valueType, KeyDeserializer keyDeser, JsonDeserializer<java.lang.Object> valueDeser, TypeDeserializer typeDeser)
- Since:
- 2.14
-
constructForJsonNodeField
public static SettableAnyProperty constructForJsonNodeField(DeserializationContext ctxt, BeanProperty property, AnnotatedMember field, JavaType valueType, JsonDeserializer<java.lang.Object> valueDeser)
- Since:
- 2.14
-
constructForMapParameter
public static SettableAnyProperty constructForMapParameter(DeserializationContext ctxt, BeanProperty property, AnnotatedMember field, JavaType valueType, KeyDeserializer keyDeser, JsonDeserializer<java.lang.Object> valueDeser, TypeDeserializer typeDeser, int parameterIndex)
- Since:
- 2.18
-
constructForJsonNodeParameter
public static SettableAnyProperty constructForJsonNodeParameter(DeserializationContext ctxt, BeanProperty prop, AnnotatedMember mutator, JavaType valueType, JsonDeserializer<java.lang.Object> valueDeser, int parameterIndex)
-
withValueDeserializer
public abstract SettableAnyProperty withValueDeserializer(JsonDeserializer<java.lang.Object> deser)
-
fixAccess
public void fixAccess(DeserializationConfig config)
-
readResolve
java.lang.Object readResolve()
Need to define this to verify that we retain actual Method reference
-
getProperty
public BeanProperty getProperty()
-
hasValueDeserializer
public boolean hasValueDeserializer()
-
getType
public JavaType getType()
-
getPropertyName
public java.lang.String getPropertyName()
- Since:
- 2.14
-
getParameterIndex
public int getParameterIndex()
Accessor for parameterIndex.- Returns:
- -1 if not a parameterized setter, otherwise index of parameter
- Since:
- 2.18
-
isFieldType
public boolean isFieldType()
Method called to check whether this property is field- Since:
- 2.18.1
-
isSetterType
public boolean isSetterType()
Method called to check whether this property is method- Returns:
- 2.18.2
-
createParameterObject
public java.lang.Object createParameterObject()
Create an instance of value to pass through Creator parameter.- Since:
- 2.18
-
deserializeAndSet
public void deserializeAndSet(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt, java.lang.Object instance, java.lang.String propName) throws java.io.IOExceptionMethod called to deserialize appropriate value, given parser (and context), and set it using appropriate method (a setter method).- Throws:
java.io.IOException
-
deserialize
public java.lang.Object deserialize(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws java.io.IOException- Throws:
java.io.IOException
-
set
public void set(java.lang.Object instance, java.lang.Object propName, java.lang.Object value) throws java.io.IOException- Throws:
java.io.IOException
-
_set
protected abstract void _set(java.lang.Object instance, java.lang.Object propName, java.lang.Object value) throws java.lang.Exception- Throws:
java.lang.Exception
-
_throwAsIOE
protected void _throwAsIOE(java.lang.Exception e, java.lang.Object propName, java.lang.Object value) throws java.io.IOException- Parameters:
e- Exception to re-throw or wrappropName- Name of property (from Json input) to setvalue- Value of the property- Throws:
java.io.IOException
-
getClassName
private java.lang.String getClassName()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-