Top Description Fields Constructors Methods
tools.jackson.databind.ser.std

public abstract Class ToStringSerializerBase

extends StdSerializer<Object>
Class Inheritance
Known Direct Subclasses
tools.jackson.databind.ext.javatime.ser.ZoneIdSerializer, tools.jackson.databind.ser.jdk.NumberSerializer.BigDecimalAsStringSerializer, tools.jackson.databind.ser.std.ToStringSerializer
Imports
tools.jackson.core.JacksonException, .JsonGenerator, .JsonToken, tools.jackson.core.type.WritableTypeId, tools.jackson.databind.JavaType, .SerializationContext, tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper, tools.jackson.databind.jsontype.TypeSerializer

Intermediate base class that serves as base for standard ToStringSerializer as well as for custom subtypes that want to add processing for converting from value to output into its String representation (whereas standard version simply calls value object's toString() method).

Field Summary

Inherited from tools.jackson.databind.ser.std.StdSerializer:
_handledType

Constructor Summary

AccessConstructor and Description
public
ToStringSerializerBase(Class<?> handledType)

Method Summary

Modifier and TypeMethod and Description
public void
public boolean
isEmpty(SerializationContext prov, Object value)

Overrides tools.jackson.databind.ValueSerializer.isEmpty.

Method called to check whether given serializable value is considered "empty" value (for purposes of suppressing serialization of empty values).

public void
serialize(Object value, JsonGenerator gen, SerializationContext provider)

Implements abstract tools.jackson.databind.ser.std.StdSerializer.serialize.

Method that can be called to ask implementation to serialize values of type this serializer handles.

public void
serializeWithType(Object value, JsonGenerator g, SerializationContext ctxt, TypeSerializer typeSer)

Overrides tools.jackson.databind.ValueSerializer.serializeWithType.

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.

public abstract String
Inherited from tools.jackson.databind.ser.std.StdSerializer:
_neitherNull_nonEmpty_wrapIOFailureacceptJsonFormatVisitorForBinarycreateSchemaNodecreateSchemaNodefindAnnotatedContentSerializerfindContextualConvertingSerializerfindFormatFeaturefindFormatOverridesfindIncludeOverridesfindPropertyFilterhandledTypeisDefaultSerializervisitArrayFormatvisitArrayFormatvisitFloatFormatvisitIntFormatvisitIntFormatvisitStringFormatvisitStringFormatwrapAndThrowwrapAndThrow

Constructor Detail

ToStringSerializerBaseback to summary
public ToStringSerializerBase(Class<?> handledType)

Method Detail

acceptJsonFormatVisitorback to summary
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)

Overrides tools.jackson.databind.ser.std.StdSerializer.acceptJsonFormatVisitor.

Implements tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitable.acceptJsonFormatVisitor.

Doc from tools.jackson.databind.ser.std.StdSerializer.acceptJsonFormatVisitor.

Default implementation specifies no format. This behavior is usually overriden by custom serializers.

Annotations
@Override
isEmptyback to summary
public boolean isEmpty(SerializationContext prov, Object value)

Overrides tools.jackson.databind.ValueSerializer.isEmpty.

Doc from tools.jackson.databind.ValueSerializer.isEmpty.

Method called to check whether given serializable value is considered "empty" value (for purposes of suppressing serialization of empty values).

Default implementation will consider only null values to be empty.

Annotations
@Override
serializeback to summary
public void serialize(Object value, JsonGenerator gen, SerializationContext provider) throws JacksonException

Implements abstract tools.jackson.databind.ser.std.StdSerializer.serialize.

Doc from tools.jackson.databind.ValueSerializer.serialize.

Method that can be called to ask implementation to serialize values of type this serializer handles.

Annotations
@Override
serializeWithTypeback to summary
public void serializeWithType(Object value, JsonGenerator g, SerializationContext ctxt, TypeSerializer typeSer) throws JacksonException

Overrides tools.jackson.databind.ValueSerializer.serializeWithType.

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. This should work for most cases; some sub-classes may want to change this behavior.

Annotations
@Override
valueToStringback to summary
public abstract String valueToString(Object value)