SchemaAwareToStringSerializerpublic class ToStringSerializer extends SerializerBase<java.lang.Object>
Object.toString() returns the desired JSON
value.JsonSerializer.None| Modifier and Type | Field | Description |
|---|---|---|
static ToStringSerializer |
instance |
Singleton instance to use.
|
_handledType| Constructor | Description |
|---|---|
ToStringSerializer() |
Note: usually you should NOT create new instances, but instead use
instance which is stateless and fully thread-safe. |
| Modifier and Type | Method | Description |
|---|---|---|
JsonNode |
getSchema(SerializerProvider provider,
java.lang.reflect.Type typeHint) |
Note: since Jackson 1.9, default implementation claims type is "string"
|
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.
|
void |
serializeWithType(java.lang.Object value,
JsonGenerator jgen,
SerializerProvider provider,
TypeSerializer typeSer) |
Default implementation will write type prefix, call regular serialization
method (since assumption is that value itself does not need JSON
Array or Object start/end markers), and then write type suffix.
|
isUnwrappingSerializer, unwrappingSerializerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateObjectNode, createSchemaNode, createSchemaNode, handledType, isDefaultSerializer, wrapAndThrow, wrapAndThrow, wrapAndThrow, wrapAndThrowpublic static final ToStringSerializer instance
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
JsonSerialize.using().
public void serialize(java.lang.Object value,
JsonGenerator jgen,
SerializerProvider provider)
throws java.io.IOException,
JsonGenerationException
JsonSerializerserialize in class SerializerBase<java.lang.Object>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.java.io.IOExceptionJsonGenerationExceptionpublic void serializeWithType(java.lang.Object value,
JsonGenerator jgen,
SerializerProvider provider,
TypeSerializer typeSer)
throws java.io.IOException,
JsonGenerationException
serializeWithType in class JsonSerializer<java.lang.Object>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.typeSer - Type serializer to use for including type informationjava.io.IOExceptionJsonGenerationExceptionpublic JsonNode getSchema(SerializerProvider provider, java.lang.reflect.Type typeHint) throws JsonMappingException
SerializerBasegetSchema in interface SchemaAwaregetSchema in class SerializerBase<java.lang.Object>provider - The serializer provider.typeHint - A hint about the type.JsonMappingException