org.codehaus.jackson.map.deser
Class SettableBeanProperty

java.lang.Object
  extended by org.codehaus.jackson.map.deser.SettableBeanProperty
Direct Known Subclasses:
SettableBeanProperty.CreatorProperty, SettableBeanProperty.FieldProperty, SettableBeanProperty.ManagedReferenceProperty, SettableBeanProperty.MethodProperty, SettableBeanProperty.SetterlessProperty

public abstract class SettableBeanProperty
extends Object

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
static class SettableBeanProperty.CreatorProperty
          This concrete sub-class implements property that is passed via Creator (constructor or static factory method).
static class SettableBeanProperty.FieldProperty
          This concrete sub-class implements property that is set directly assigning to a Field.
static class SettableBeanProperty.ManagedReferenceProperty
          Wrapper property that is used to handle managed (forward) properties (see [JACKSON-235] for more information).
static class SettableBeanProperty.MethodProperty
          This concrete sub-class implements property that is set using regular "setter" method.
static class SettableBeanProperty.SetterlessProperty
          This concrete sub-class implements Collection or Map property that is indirectly by getting the property value and directly modifying it.
 
Field Summary
protected  String _managedReferenceName
          If property represents a managed (forward) reference (see [JACKSON-235]), we will need name of reference for later linking.
protected  Object _nullValue
          Value to be used when 'null' literal is encountered in Json.
protected  String _propName
          Logical name of the property (often but not always derived from the setter method name)
protected  JavaType _type
           
protected  JsonDeserializer<Object> _valueDeserializer
           
protected  TypeDeserializer _valueTypeDeserializer
          If value will contain type information (to support polymorphic handling), this is the type deserializer used to handle type resolution.
 
Constructor Summary
protected SettableBeanProperty(String propName, JavaType type, TypeDeserializer typeDeser)
           
 
Method Summary
protected  IOException _throwAsIOE(Exception e)
           
protected  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.
 Object deserialize(JsonParser jp, DeserializationContext ctxt)
          This method is needed by some specialized bean deserializers, and also called by some deserializeAndSet(org.codehaus.jackson.JsonParser, org.codehaus.jackson.map.DeserializationContext, java.lang.Object) implementations.
abstract  void deserializeAndSet(JsonParser jp, DeserializationContext ctxt, Object instance)
          Method called to deserialize appropriate value, given parser (and context), and set it using appropriate mechanism.
 int getCreatorIndex()
          Method to use for accessing index of the property (related to other properties in the same context); currently only applicable to "Creator properties".
protected abstract  Class<?> getDeclaringClass()
           
 String getManagedReferenceName()
           
 String getPropertyName()
           
 JavaType getType()
           
 boolean hasValueDeserializer()
           
abstract  void set(Object instance, Object value)
           
 void setManagedReferenceName(String n)
           
 void setValueDeserializer(JsonDeserializer<Object> deser)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_propName

protected final String _propName
Logical name of the property (often but not always derived from the setter method name)


_type

protected final JavaType _type

_valueDeserializer

protected JsonDeserializer<Object> _valueDeserializer

_valueTypeDeserializer

protected TypeDeserializer _valueTypeDeserializer
If value will contain type information (to support polymorphic handling), this is the type deserializer used to handle type resolution.


_nullValue

protected Object _nullValue
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).


_managedReferenceName

protected String _managedReferenceName
If property represents a managed (forward) reference (see [JACKSON-235]), we will need name of reference for later linking.

Constructor Detail

SettableBeanProperty

protected SettableBeanProperty(String propName,
                               JavaType type,
                               TypeDeserializer typeDeser)
Method Detail

setValueDeserializer

public void setValueDeserializer(JsonDeserializer<Object> deser)

setManagedReferenceName

public void setManagedReferenceName(String n)

getDeclaringClass

protected abstract Class<?> getDeclaringClass()

getPropertyName

public String getPropertyName()

getType

public JavaType getType()

getManagedReferenceName

public String getManagedReferenceName()

hasValueDeserializer

public boolean hasValueDeserializer()

getCreatorIndex

public int getCreatorIndex()
Method to use for accessing index of the property (related to other properties in the same context); currently only applicable to "Creator properties".

Base implementation returns -1 to indicate that no index exists for the property.


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:
IOException
JsonProcessingException

set

public abstract void set(Object instance,
                         Object value)
                  throws IOException
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 some deserializeAndSet(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:
IOException
JsonProcessingException

_throwAsIOE

protected void _throwAsIOE(Exception e,
                           Object value)
                    throws IOException
Method that takes in exception of any type, and casts or wraps it to an IOException or its subclass.

Throws:
IOException

_throwAsIOE

protected IOException _throwAsIOE(Exception e)
                           throws IOException
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object