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
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 ClassesModifier and TypeClassDescriptionstatic final classThis concrete sub-class implements property that is set directly assigning to a Field.static final classThis sub-class is used to handle special case of value being a non-static inner class.static final classWrapper property that is used to handle managed (forward) properties (see [JACKSON-235] for more information).static final classThis concrete sub-class implements property that is set using regular "setter" method.protected static final classTo 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 final classThis 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
FieldsModifier and TypeFieldDescriptionprotected final AnnotationsClass 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 StringIf property represents a managed (forward) reference (see [JACKSON-235]), we will need name of reference for later linking.protected SettableBeanProperty.NullProviderObject used to figure out value to be used when 'null' literal is encountered in JSON.protected intIndex of property (within all property of a bean); assigned when all properties have been collected.protected final StringLogical name of the property (often but not always derived from the setter method name)protected final JavaTypeBase type for property; may be a supertype of actual value.protected JsonDeserializer<Object> Deserializer used for handling property value.protected TypeDeserializerIf value will contain type information (to support polymorphic handling), this is the type deserializer used to handle type resolution. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSettableBeanProperty(String propName, JavaType type, TypeDeserializer typeDeser, Annotations contextAnnotations) protectedBasic copy-constructor for sub-classes to use.protectedSettableBeanProperty(SettableBeanProperty src, JsonDeserializer<Object> deser) Copy-with-deserializer-change constructor for sub-classes to use. -
Method Summary
Modifier and TypeMethodDescriptionprotected IOExceptionprotected void_throwAsIOE(Exception e, 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.final 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, Object instance) Method called to deserialize appropriate value, given parser (and context), and set it using appropriate mechanism.abstract <A extends Annotation>
AgetAnnotation(Class<A> acls) Method for finding annotation associated with this property; meaning annotation associated with one of entities used to access property.<A extends Annotation>
AgetContextAnnotation(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 final Class<?> Accessor for id of injectable value, if this bean property supports value injection.abstract AnnotatedMemberMethod for accessing primary physical entity that represents the property; annotated field, method or constructor property.final StringgetName()Method to get logical name of the propertyintMethod for accessing unique index of this property; indexes are assigned once all properties of aBeanDeserializerhave been collected.Deprecated.intDeprecated.Since 1.9: usegetPropertyIndex()insteadgetType()Method to get declared type of the property.booleanbooleanabstract voidvoidvoidDeprecated.toString()abstract SettableBeanProperty
-
Field Details
-
_propName
Logical name of the property (often but not always derived from the setter method name) -
_type
Base type for property; may be a supertype of actual value. -
_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
Deserializer used for handling property value. -
_valueTypeDeserializer
If value will contain type information (to support polymorphic handling), this is the type deserializer used to handle type resolution. -
_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
If property represents a managed (forward) reference (see [JACKSON-235]), we will need name of reference for later linking. -
_propertyIndex
protected int _propertyIndexIndex 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 Details
-
SettableBeanProperty
protected SettableBeanProperty(String propName, JavaType type, TypeDeserializer typeDeser, Annotations contextAnnotations) -
SettableBeanProperty
Basic copy-constructor for sub-classes to use.- Since:
- 1.9
-
SettableBeanProperty
Copy-with-deserializer-change constructor for sub-classes to use.- Since:
- 1.9
-
-
Method Details
-
setValueDeserializer
Deprecated. -
withValueDeserializer
- Since:
- 1.9
-
setManagedReferenceName
-
assignIndex
public void assignIndex(int index) Method used to assign index for property.- Since:
- 1.7
-
getName
Description copied from interface:BeanPropertyMethod to get logical name of the property- Specified by:
getNamein interfaceBeanProperty- Specified by:
getNamein interfaceNamed
-
getType
Description copied from interface:BeanPropertyMethod to get declared type of the property.- Specified by:
getTypein interfaceBeanProperty
-
getAnnotation
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
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
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
-
getPropertyName
Deprecated.Since 1.7, usegetName()instead. -
getManagedReferenceName
-
hasValueDeserializer
public boolean hasValueDeserializer() -
hasValueTypeDeserializer
public boolean hasValueTypeDeserializer()- Since:
- 1.9
-
getValueDeserializer
- Since:
- 1.9
-
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.Since 1.9: usegetPropertyIndex()instead -
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, Object instance) throws 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:
IOExceptionJsonProcessingException
-
set
- Throws:
IOException
-
deserialize
public final Object deserialize(JsonParser jp, DeserializationContext ctxt) throws 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:
IOExceptionJsonProcessingException
-
_throwAsIOE
Method that takes in exception of any type, and casts or wraps it to an IOException or its subclass.- Throws:
IOException
-
_throwAsIOE
- Throws:
IOException
-
toString
-
getName()instead.