Class ToStringSerializer
- java.lang.Object
-
- com.fasterxml.jackson.databind.JsonSerializer<T>
-
- com.fasterxml.jackson.databind.ser.std.StdSerializer<java.lang.Object>
-
- com.fasterxml.jackson.databind.ser.std.ToStringSerializerBase
-
- com.fasterxml.jackson.databind.ser.std.ToStringSerializer
-
- All Implemented Interfaces:
JsonFormatVisitable
,SchemaAware
,java.io.Serializable
public class ToStringSerializer extends ToStringSerializerBase
Simple general purpose serializer, useful for any type for whichObject.toString()
returns the desired JSON value.Since 2.10 extends
ToStringSerializerBase
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer
JsonSerializer.None
-
-
Field Summary
Fields Modifier and Type Field Description static ToStringSerializer
instance
Singleton instance to use.
-
Constructor Summary
Constructors Constructor Description ToStringSerializer()
Note: usually you should NOT create new instances, but instead useinstance
which is stateless and fully thread-safe.ToStringSerializer(java.lang.Class<?> handledType)
Sometimes it may actually make sense to retain actual handled type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
valueToString(java.lang.Object value)
-
Methods inherited from class com.fasterxml.jackson.databind.ser.std.ToStringSerializerBase
acceptJsonFormatVisitor, getSchema, isEmpty, serialize, serializeWithType
-
Methods inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer
getSchema, handledType, wrapAndThrow, wrapAndThrow
-
Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer
getDelegatee, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, unwrappingSerializer, usesObjectId, withFilterId
-
-
-
-
Field Detail
-
instance
public static final ToStringSerializer instance
Singleton instance to use.
-
-
Constructor Detail
-
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 likeJsonSerialize.using()
.
-
ToStringSerializer
public ToStringSerializer(java.lang.Class<?> handledType)
Sometimes it may actually make sense to retain actual handled type.- Since:
- 2.5
-
-
Method Detail
-
valueToString
public final java.lang.String valueToString(java.lang.Object value)
- Specified by:
valueToString
in classToStringSerializerBase
-
-