|
||||||||||
| 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 class BeanPropertyWriter
Base bean property handler class, which implements common parts of reflection-based functionality for accessing a property value and serializing it.
| Field Summary | |
|---|---|
protected Method |
_accessorMethod
Accessor method used to get property value, for method-accessible properties. |
protected JavaType |
_cfgSerializationType
Type to use for locating serializer; normally same as return type of the accessor method, but may be overridden by annotations. |
protected Field |
_field
Field that contains the property value for field-accessible properties. |
protected Class<?>[] |
_includeInViews
Alternate set of property writers used when view-based filtering is available for the Bean. |
protected String |
_name
Logical name of the property; will be used as the field name under which value for the property is written. |
protected JavaType |
_nonTrivialBaseType
Base type of the property, if the declared type is "non-trivial"; meaning it is either a structured type (collection, map, array), or parametrized. |
protected JsonSerializer<Object> |
_serializer
Serializer to use for writing out the value: null if it can not be known statically; non-null if it can. |
protected Object |
_suppressableValue
Value that is considered default value of the property; used for default-value-suppression if enabled. |
protected boolean |
_suppressNulls
Flag to indicate that null values for this property are not to be written out. |
protected TypeSerializer |
_typeSerializer
If property being serialized needs type information to be included this is the type serializer to use. |
| Constructor Summary | |
|---|---|
protected |
BeanPropertyWriter(BeanPropertyWriter base)
"Copy constructor" to be used by filtering sub-classes |
|
BeanPropertyWriter(String name,
JsonSerializer<Object> ser,
TypeSerializer typeSer,
JavaType serType,
Method acc,
Field f,
boolean suppressNulls,
Object suppressableValue)
|
| Method Summary | |
|---|---|
protected void |
_reportSelfReference(Object bean)
|
Object |
get(Object bean)
Method that can be used to access value of the property this Object describes, from given bean instance. |
Type |
getGenericPropertyType()
Get the generic property type of this property writer. |
String |
getName()
|
Class<?> |
getPropertyType()
|
Class<?> |
getRawSerializationType()
|
JavaType |
getSerializationType()
|
protected JsonSerializer<Object> |
getSerializer()
|
Class<?>[] |
getViews()
|
boolean |
hasSerializer()
|
void |
serializeAsField(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. |
void |
setNonTrivialBaseType(JavaType t)
Method called to define type to consider as "non-trivial" basetype, needed for dynamic serialization resolution for complex (usually container) types |
void |
setViews(Class<?>[] views)
Method for defining which views to included value of this property in. |
String |
toString()
|
BeanPropertyWriter |
withSerializer(JsonSerializer<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 Method _accessorMethod
_field is null.
protected final Field _field
_accessorMethod is null.
protected final String _name
protected final JavaType _cfgSerializationType
protected final JsonSerializer<Object> _serializer
protected final boolean _suppressNulls
protected final Object _suppressableValue
protected Class<?>[] _includeInViews
protected TypeSerializer _typeSerializer
protected JavaType _nonTrivialBaseType
| Constructor Detail |
|---|
public BeanPropertyWriter(String name,
JsonSerializer<Object> ser,
TypeSerializer typeSer,
JavaType serType,
Method acc,
Field f,
boolean suppressNulls,
Object suppressableValue)
suppressableValue - Value to suppressprotected BeanPropertyWriter(BeanPropertyWriter base)
| Method Detail |
|---|
public BeanPropertyWriter withSerializer(JsonSerializer<Object> ser)
public void setViews(Class<?>[] views)
public void setNonTrivialBaseType(JavaType t)
public final String getName()
public boolean hasSerializer()
protected JsonSerializer<Object> getSerializer()
public JavaType getSerializationType()
public Class<?> getRawSerializationType()
public Class<?> getPropertyType()
public Type getGenericPropertyType()
public Class<?>[] getViews()
public void serializeAsField(Object bean,
JsonGenerator jgen,
SerializerProvider prov)
throws Exception
Exception
public final Object get(Object bean)
throws 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
Exceptionpublic String toString()
toString in class Object
protected void _reportSelfReference(Object bean)
throws JsonMappingException
JsonMappingException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||