org.codehaus.jackson.map.ser
Class BeanPropertyWriter.NonNullMethod

java.lang.Object
  extended by org.codehaus.jackson.map.ser.BeanPropertyWriter
      extended by org.codehaus.jackson.map.ser.BeanPropertyWriter.NonNullMethod
Enclosing class:
BeanPropertyWriter

public static final class BeanPropertyWriter.NonNullMethod
extends BeanPropertyWriter

Property writer that outputs all property if and only if it has non-null value.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.codehaus.jackson.map.ser.BeanPropertyWriter
BeanPropertyWriter.NonDefaultField, BeanPropertyWriter.NonDefaultMethod, BeanPropertyWriter.NonNullField, BeanPropertyWriter.NonNullMethod, BeanPropertyWriter.StdField, BeanPropertyWriter.StdMethod
 
Field Summary
protected  Method _accessorMethod
          Accessor method used to get property value
 
Fields inherited from class org.codehaus.jackson.map.ser.BeanPropertyWriter
_cfgSerializationType, _name, _serializer
 
Constructor Summary
BeanPropertyWriter.NonNullMethod(String name, JsonSerializer<Object> ser, Class<?> serType, Method acc)
           
 
Method Summary
 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.
 Class<?> getReturnType()
           
 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.
 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 org.codehaus.jackson.map.ser.BeanPropertyWriter
getName, getSerializationType, hasSerializer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_accessorMethod

protected final Method _accessorMethod
Accessor method used to get property value

Constructor Detail

BeanPropertyWriter.NonNullMethod

public BeanPropertyWriter.NonNullMethod(String name,
                                        JsonSerializer<Object> ser,
                                        Class<?> serType,
                                        Method acc)
Method Detail

withSerializer

public BeanPropertyWriter withSerializer(JsonSerializer<Object> ser)
Description copied from class: BeanPropertyWriter
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).

Specified by:
withSerializer in class BeanPropertyWriter

serializeAsField

public void serializeAsField(Object bean,
                             JsonGenerator jgen,
                             SerializerProvider prov)
                      throws Exception
Description copied from class: BeanPropertyWriter
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.

Specified by:
serializeAsField in class BeanPropertyWriter
Throws:
Exception

getReturnType

public final Class<?> getReturnType()
Specified by:
getReturnType in class BeanPropertyWriter

get

public final Object get(Object bean)
                 throws Exception
Description copied from class: BeanPropertyWriter
Method that can be used to access value of the property this Object describes, from given bean instance.

Note: method is final as it should not need to be overridden -- rather, calling method(s) (BeanPropertyWriter.serializeAsField(java.lang.Object, org.codehaus.jackson.JsonGenerator, org.codehaus.jackson.map.SerializerProvider)) should be overridden to change the behavior

Specified by:
get in class BeanPropertyWriter
Throws:
Exception

toString

public String toString()
Overrides:
toString in class Object

getGenericPropertyType

public Type getGenericPropertyType()
Description copied from class: BeanPropertyWriter
Get the generic property type of this property writer.

Specified by:
getGenericPropertyType in class BeanPropertyWriter
Returns:
The property type, or null if not found.