Package org.codehaus.jackson.map.deser
Class SettableBeanProperty
- java.lang.Object
-
- org.codehaus.jackson.map.deser.SettableBeanProperty
-
- All Implemented Interfaces:
BeanProperty,Named
- Direct Known Subclasses:
CreatorProperty,SettableBeanProperty.FieldProperty,SettableBeanProperty.InnerClassProperty,SettableBeanProperty.ManagedReferenceProperty,SettableBeanProperty.MethodProperty,SettableBeanProperty.SetterlessProperty
public abstract class SettableBeanProperty extends java.lang.Object implements BeanProperty
Base class for settable properties of a bean: contains both type and name definitions, and reflection-based set functionality. Concrete sub-classes implement details, so that both field- and setter-backed properties can be handled
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSettableBeanProperty.FieldPropertyThis concrete sub-class implements property that is set directly assigning to a Field.static classSettableBeanProperty.InnerClassPropertyThis sub-class is used to handle special case of value being a non-static inner class.static classSettableBeanProperty.ManagedReferencePropertyWrapper property that is used to handle managed (forward) properties (see [JACKSON-235] for more information).static classSettableBeanProperty.MethodPropertyThis concrete sub-class implements property that is set using regular "setter" method.protected static classSettableBeanProperty.NullProviderTo support [JACKSON-420] we need bit more indirection; this is used to produce artificial failure for primitives that don't accept JSON null as value.static classSettableBeanProperty.SetterlessPropertyThis concrete sub-class implements Collection or Map property that is indirectly by getting the property value and directly modifying it.-
Nested classes/interfaces inherited from interface org.codehaus.jackson.map.BeanProperty
BeanProperty.Std
-
-
Field Summary
Fields Modifier and Type Field Description protected Annotations_contextAnnotationsClass that contains this property (either class that declares the property or one of its subclasses), class that is deserialized using deserializer that contains this property.protected java.lang.String_managedReferenceNameIf property represents a managed (forward) reference (see [JACKSON-235]), we will need name of reference for later linking.protected SettableBeanProperty.NullProvider_nullProviderObject used to figure out value to be used when 'null' literal is encountered in JSON.protected int_propertyIndexIndex of property (within all property of a bean); assigned when all properties have been collected.protected java.lang.String_propNameLogical name of the property (often but not always derived from the setter method name)protected JavaType_typeBase type for property; may be a supertype of actual value.protected JsonDeserializer<java.lang.Object>_valueDeserializerDeserializer used for handling property value.protected TypeDeserializer_valueTypeDeserializerIf value will contain type information (to support polymorphic handling), this is the type deserializer used to handle type resolution.
-
Constructor Summary
Constructors Modifier Constructor Description protectedSettableBeanProperty(java.lang.String propName, JavaType type, TypeDeserializer typeDeser, Annotations contextAnnotations)protectedSettableBeanProperty(SettableBeanProperty src)Basic copy-constructor for sub-classes to use.protectedSettableBeanProperty(SettableBeanProperty src, JsonDeserializer<java.lang.Object> deser)Copy-with-deserializer-change constructor for sub-classes to use.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected java.io.IOException_throwAsIOE(java.lang.Exception e)protected void_throwAsIOE(java.lang.Exception e, java.lang.Object value)Method that takes in exception of any type, and casts or wraps it to an IOException or its subclass.voidassignIndex(int index)Method used to assign index for property.java.lang.Objectdeserialize(JsonParser jp, DeserializationContext ctxt)This method is needed by some specialized bean deserializers, and also called by somedeserializeAndSet(org.codehaus.jackson.JsonParser, org.codehaus.jackson.map.DeserializationContext, java.lang.Object)implementations.abstract voiddeserializeAndSet(JsonParser jp, DeserializationContext ctxt, java.lang.Object instance)Method called to deserialize appropriate value, given parser (and context), and set it using appropriate mechanism.abstract <A extends java.lang.annotation.Annotation>
AgetAnnotation(java.lang.Class<A> acls)Method for finding annotation associated with this property; meaning annotation associated with one of entities used to access property.<A extends java.lang.annotation.Annotation>
AgetContextAnnotation(java.lang.Class<A> acls)Method for finding annotation associated with context of this property; usually class in which member is declared (or its subtype if processing subtype).protected java.lang.Class<?>getDeclaringClass()java.lang.ObjectgetInjectableValueId()Accessor for id of injectable value, if this bean property supports value injection.java.lang.StringgetManagedReferenceName()abstract AnnotatedMembergetMember()Method for accessing primary physical entity that represents the property; annotated field, method or constructor property.java.lang.StringgetName()Method to get logical name of the propertyintgetPropertyIndex()Method for accessing unique index of this property; indexes are assigned once all properties of aBeanDeserializerhave been collected.java.lang.StringgetPropertyName()Deprecated.Since 1.7, usegetName()instead.intgetProperytIndex()Deprecated.Since 1.9: usegetPropertyIndex()insteadJavaTypegetType()Method to get declared type of the property.JsonDeserializer<java.lang.Object>getValueDeserializer()TypeDeserializergetValueTypeDeserializer()booleanhasValueDeserializer()booleanhasValueTypeDeserializer()abstract voidset(java.lang.Object instance, java.lang.Object value)voidsetManagedReferenceName(java.lang.String n)voidsetValueDeserializer(JsonDeserializer<java.lang.Object> deser)Deprecated.java.lang.StringtoString()abstract SettableBeanPropertywithValueDeserializer(JsonDeserializer<java.lang.Object> deser)
-
-
-
Field Detail
-
_propName
protected final java.lang.String _propName
Logical name of the property (often but not always derived from the setter method name)
-
_type
protected final JavaType _type
Base type for property; may be a supertype of actual value.
-
_contextAnnotations
protected final Annotations _contextAnnotations
Class that contains this property (either class that declares the property or one of its subclasses), class that is deserialized using deserializer that contains this property.
-
_valueDeserializer
protected JsonDeserializer<java.lang.Object> _valueDeserializer
Deserializer used for handling property value.
-
_valueTypeDeserializer
protected TypeDeserializer _valueTypeDeserializer
If value will contain type information (to support polymorphic handling), this is the type deserializer used to handle type resolution.
-
_nullProvider
protected SettableBeanProperty.NullProvider _nullProvider
Object used to figure out value to be used when 'null' literal is encountered in JSON. For most types simply Java null, but for primitive types must be a non-null value (like Integer.valueOf(0) for int).- Since:
- 1.7
-
_managedReferenceName
protected java.lang.String _managedReferenceName
If property represents a managed (forward) reference (see [JACKSON-235]), we will need name of reference for later linking.
-
_propertyIndex
protected int _propertyIndex
Index of property (within all property of a bean); assigned when all properties have been collected. Order of entries is arbitrary, but once indexes are assigned they are not changed.- Since:
- 1.7
-
-
Constructor Detail
-
SettableBeanProperty
protected SettableBeanProperty(java.lang.String propName, JavaType type, TypeDeserializer typeDeser, Annotations contextAnnotations)
-
SettableBeanProperty
protected SettableBeanProperty(SettableBeanProperty src)
Basic copy-constructor for sub-classes to use.- Since:
- 1.9
-
SettableBeanProperty
protected SettableBeanProperty(SettableBeanProperty src, JsonDeserializer<java.lang.Object> deser)
Copy-with-deserializer-change constructor for sub-classes to use.- Since:
- 1.9
-
-
Method Detail
-
setValueDeserializer
@Deprecated public void setValueDeserializer(JsonDeserializer<java.lang.Object> deser)
Deprecated.
-
withValueDeserializer
public abstract SettableBeanProperty withValueDeserializer(JsonDeserializer<java.lang.Object> deser)
- Since:
- 1.9
-
setManagedReferenceName
public void setManagedReferenceName(java.lang.String n)
-
assignIndex
public void assignIndex(int index)
Method used to assign index for property.- Since:
- 1.7
-
getName
public final java.lang.String getName()
Description copied from interface:BeanPropertyMethod to get logical name of the property- Specified by:
getNamein interfaceBeanProperty- Specified by:
getNamein interfaceNamed
-
getType
public JavaType getType()
Description copied from interface:BeanPropertyMethod to get declared type of the property.- Specified by:
getTypein interfaceBeanProperty
-
getAnnotation
public abstract <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> acls)
Description copied from interface:BeanPropertyMethod for finding annotation associated with this property; meaning annotation associated with one of entities used to access property.- Specified by:
getAnnotationin interfaceBeanProperty
-
getMember
public abstract AnnotatedMember getMember()
Description copied from interface:BeanPropertyMethod for accessing primary physical entity that represents the property; annotated field, method or constructor property.- Specified by:
getMemberin interfaceBeanProperty
-
getContextAnnotation
public <A extends java.lang.annotation.Annotation> A getContextAnnotation(java.lang.Class<A> acls)
Description copied from interface:BeanPropertyMethod for finding annotation associated with context of this property; usually class in which member is declared (or its subtype if processing subtype).- Specified by:
getContextAnnotationin interfaceBeanProperty
-
getDeclaringClass
protected final java.lang.Class<?> getDeclaringClass()
-
getPropertyName
@Deprecated public java.lang.String getPropertyName()
Deprecated.Since 1.7, usegetName()instead.
-
getManagedReferenceName
public java.lang.String getManagedReferenceName()
-
hasValueDeserializer
public boolean hasValueDeserializer()
-
hasValueTypeDeserializer
public boolean hasValueTypeDeserializer()
- Since:
- 1.9
-
getValueDeserializer
public JsonDeserializer<java.lang.Object> getValueDeserializer()
- Since:
- 1.9
-
getValueTypeDeserializer
public TypeDeserializer getValueTypeDeserializer()
- Since:
- 1.9
-
getPropertyIndex
public int getPropertyIndex()
Method for accessing unique index of this property; indexes are assigned once all properties of aBeanDeserializerhave been collected.- Returns:
- Index of this property
- Since:
- 1.7 Although note that it was misspelled as "getProperytIndex"; fixed in 1.9
-
getProperytIndex
@Deprecated public int getProperytIndex()
Deprecated.Since 1.9: usegetPropertyIndex()instead
-
getInjectableValueId
public java.lang.Object getInjectableValueId()
Accessor for id of injectable value, if this bean property supports value injection.- Since:
- 1.9
-
deserializeAndSet
public abstract void deserializeAndSet(JsonParser jp, DeserializationContext ctxt, java.lang.Object instance) throws java.io.IOException, JsonProcessingException
Method 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).- Throws:
java.io.IOExceptionJsonProcessingException
-
set
public abstract void set(java.lang.Object instance, java.lang.Object value) throws java.io.IOException- Throws:
java.io.IOException
-
deserialize
public final java.lang.Object deserialize(JsonParser jp, DeserializationContext ctxt) throws java.io.IOException, JsonProcessingException
This method is needed by some specialized bean deserializers, and also called by somedeserializeAndSet(org.codehaus.jackson.JsonParser, org.codehaus.jackson.map.DeserializationContext, java.lang.Object)implementations.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).
- Throws:
java.io.IOExceptionJsonProcessingException
-
_throwAsIOE
protected void _throwAsIOE(java.lang.Exception e, java.lang.Object value) throws java.io.IOExceptionMethod that takes in exception of any type, and casts or wraps it to an IOException or its subclass.- Throws:
java.io.IOException
-
_throwAsIOE
protected java.io.IOException _throwAsIOE(java.lang.Exception e) throws java.io.IOException- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-