|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.codehaus.jackson.map.ser.BeanPropertyWriter
public final class BeanPropertyWriter
Base bean property handler class, which implements commong parts of reflection-based functionality for accessing a property value and serializing it.
| Field Summary | |
|---|---|
protected java.lang.reflect.Method |
_accessorMethod
Accessor method used to get property value |
protected boolean |
_cfgWriteIfNull
Whether this property will be written out if its value is null or not: if true, property is always written; if false, only if its value is not null. |
protected JsonSerializer<java.lang.Object> |
_serializer
Serializer to use for writing out the value: null if it can not be known statically; non-null if it can. |
| Constructor Summary | |
|---|---|
BeanPropertyWriter(java.lang.String name,
java.lang.reflect.Method acc,
JsonSerializer<java.lang.Object> ser,
boolean writeIfNull)
|
|
| Method Summary | |
|---|---|
java.lang.Object |
get(java.lang.Object bean)
Method that can be used to access value of the property this Object describes, from given bean instance. |
java.lang.String |
getName()
|
java.lang.Class<?> |
getReturnType()
|
boolean |
hasSerializer()
|
void |
serializeAsField(java.lang.Object bean,
JsonGenerator jgen,
SerializerProvider prov)
Method called to access property that this bean stands for, from within given bean, and to serialize it as a Json Object field using appropriate serializer. |
java.lang.String |
toString()
|
BeanPropertyWriter |
withSerializer(JsonSerializer<java.lang.Object> ser)
Method that will construct and return a new writer that has same properties as this writer, but uses specified serializer instead of currently configured one (if any). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final java.lang.reflect.Method _accessorMethod
protected final boolean _cfgWriteIfNull
protected final JsonSerializer<java.lang.Object> _serializer
| Constructor Detail |
|---|
public BeanPropertyWriter(java.lang.String name,
java.lang.reflect.Method acc,
JsonSerializer<java.lang.Object> ser,
boolean writeIfNull)
| Method Detail |
|---|
public BeanPropertyWriter withSerializer(JsonSerializer<java.lang.Object> ser)
public boolean hasSerializer()
public final java.lang.Class<?> getReturnType()
public final java.lang.String getName()
public void serializeAsField(java.lang.Object bean,
JsonGenerator jgen,
SerializerProvider prov)
throws java.lang.Exception
java.lang.Exception
public final java.lang.Object get(java.lang.Object bean)
throws java.lang.Exception
Note: method is final as it should not need to be overridden -- rather,
calling method(s) (serializeAsField(java.lang.Object, org.codehaus.jackson.JsonGenerator, org.codehaus.jackson.map.SerializerProvider)) should be overridden
to change the behavior
java.lang.Exceptionpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||