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.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.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  Object _nullValue
          Value to be used when 'null' literal is encountered in Json.
protected  JsonDeserializer<Object> _valueDeserializer
           
 
Constructor Summary
SettableBeanProperty(String propName, JavaType type)
           
 
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 getPropertyName()
           
 JavaType getType()
           
 boolean hasValueDeserializer()
           
abstract  void set(Object instance, Object value)
           
 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

_valueDeserializer

protected JsonDeserializer<Object> _valueDeserializer

_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).

Constructor Detail

SettableBeanProperty

public SettableBeanProperty(String propName,
                            JavaType type)
Method Detail

setValueDeserializer

public void setValueDeserializer(JsonDeserializer<Object> deser)

getDeclaringClass

protected abstract Class<?> getDeclaringClass()

getPropertyName

public String getPropertyName()

getType

public JavaType getType()

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

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.

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