org.codehaus.jackson.map.ser
Class ToStringSerializer
java.lang.Object
org.codehaus.jackson.map.JsonSerializer<java.lang.Object>
org.codehaus.jackson.map.ser.ToStringSerializer
public final class ToStringSerializer
- extends JsonSerializer<java.lang.Object>
Simple general purpose serializer, useful for any
type for which Object.toString() returns the desired Json
value.
|
Constructor Summary |
ToStringSerializer()
Note: usually you should NOT create new instances, but instead use
instance which is stateless and fully thread-safe. |
|
Method Summary |
void |
serialize(java.lang.Object value,
JsonGenerator jgen,
SerializerProvider provider)
Method that can be called to ask implementation to serialize
values of type this serializer handles. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
instance
public static final ToStringSerializer instance
- Singleton instance to use.
ToStringSerializer
public ToStringSerializer()
Note: usually you should NOT create new instances, but instead use
instance which is stateless and fully thread-safe. However,
there are cases where constructor is needed; for example, when using
explicit serializer annotations like JsonUseSerializer.
serialize
public void serialize(java.lang.Object value,
JsonGenerator jgen,
SerializerProvider provider)
throws java.io.IOException,
JsonGenerationException
- Description copied from class:
JsonSerializer
- Method that can be called to ask implementation to serialize
values of type this serializer handles.
- Specified by:
serialize in class JsonSerializer<java.lang.Object>
- Parameters:
value - Value to serialize; can not be null.jgen - Generator used to output resulting Json contentprovider - Provider that can be used to get serializers for
serializing Objects value contains, if any.
- Throws:
java.io.IOException
JsonGenerationException