Top Description Inners Fields Constructors Methods
tools.jackson.databind.ser.jdk

public final Class BooleanSerializer

extends StdScalarSerializer<Object>
Class Inheritance
Annotations
@JacksonStdImpl
Imports
com.fasterxml.jackson.annotation.JsonFormat, tools.jackson.core.JacksonException, .JsonGenerator, .JsonParser.NumberType, tools.jackson.databind.*, tools.jackson.databind.annotation.JacksonStdImpl, tools.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper, tools.jackson.databind.jsontype.TypeSerializer, tools.jackson.databind.ser.std.StdScalarSerializer, .ToStringSerializer

Serializer used for primitive boolean, as well as java.util.Boolean wrapper type.

Since this is one of "natural" (aka "native") types, no type information is ever included on serialization (unlike for most other scalar types)

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
BooleanSerializer.AsNumber

Alternate implementation that is used when values are to be serialized as numbers 0 (false) or 1 (true).

Field Summary

Modifier and TypeField and Description
protected final boolean
_forPrimitive

Whether type serialized is primitive (boolean) or wrapper (java.lang.Boolean); if true, former, if false, latter.

Constructor Summary

AccessConstructor and Description
public
BooleanSerializer(boolean forPrimitive)

Method Summary

Modifier and TypeMethod and Description
public void
public ValueSerializer<?>
createContextual(SerializationContext serializers, BeanProperty property)

Overrides tools.jackson.databind.ValueSerializer.createContextual.

Method called to see if a different (or differently configured) serializer is needed to serialize values of specified property (or, for root values, in which case `null` is passed).

public void
serialize(Object value, JsonGenerator g, 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 final void
serializeWithType(Object value, JsonGenerator g, SerializationContext provider, TypeSerializer typeSer)

Overrides tools.jackson.databind.ser.std.StdScalarSerializer.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.

Field Detail

_forPrimitiveback to summary
protected final boolean _forPrimitive

Whether type serialized is primitive (boolean) or wrapper (java.lang.Boolean); if true, former, if false, latter.

Constructor Detail

BooleanSerializerback to summary
public BooleanSerializer(boolean forPrimitive)

Method Detail

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

Overrides tools.jackson.databind.ser.std.StdScalarSerializer.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
createContextualback to summary
public ValueSerializer<?> createContextual(SerializationContext serializers, BeanProperty property)

Overrides tools.jackson.databind.ValueSerializer.createContextual.

Doc from tools.jackson.databind.ValueSerializer.createContextual.

Method called to see if a different (or differently configured) serializer is needed to serialize values of specified property (or, for root values, in which case `null` is passed). Note that instance that this method is called on is typically shared one and as a result method should NOT modify this instance but rather construct and return a new instance. This instance should only be returned as-is, in case it is already suitable for use.

Note that method is only called once per POJO property, and for the first usage as root value serializer; it is not called for every serialization, as doing that would have significant performance impact; most serializers cache contextual instances for future use.

Annotations
@Override
serializeback to summary
public void serialize(Object value, JsonGenerator g, 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 final void serializeWithType(Object value, JsonGenerator g, SerializationContext provider, TypeSerializer typeSer) throws JacksonException

Overrides tools.jackson.databind.ser.std.StdScalarSerializer.serializeWithType.

Doc from tools.jackson.databind.ser.std.StdScalarSerializer.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
tools.jackson.databind.ser.jdk back to summary

pack-priv final Class BooleanSerializer.AsNumber

extends StdScalarSerializer<Object>
Class Inheritance

Alternate implementation that is used when values are to be serialized as numbers 0 (false) or 1 (true).

Field Summary

Modifier and TypeField and Description
protected final boolean
_forPrimitive

Whether type serialized is primitive (boolean) or wrapper (java.lang.Boolean); if true, former, if false, latter.

Constructor Summary

AccessConstructor and Description
public
AsNumber(boolean forPrimitive)

Method Summary

Modifier and TypeMethod and Description
public void
public ValueSerializer<?>
createContextual(SerializationContext serializers, BeanProperty property)

Overrides tools.jackson.databind.ValueSerializer.createContextual.

Method called to see if a different (or differently configured) serializer is needed to serialize values of specified property (or, for root values, in which case `null` is passed).

public void
serialize(Object value, JsonGenerator g, 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 final void
serializeWithType(Object value, JsonGenerator g, SerializationContext provider, TypeSerializer typeSer)

Overrides tools.jackson.databind.ser.std.StdScalarSerializer.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.

Field Detail

_forPrimitiveback to summary
protected final boolean _forPrimitive

Whether type serialized is primitive (boolean) or wrapper (java.lang.Boolean); if true, former, if false, latter.

Constructor Detail

AsNumberback to summary
public AsNumber(boolean forPrimitive)

Method Detail

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

Overrides tools.jackson.databind.ser.std.StdScalarSerializer.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
createContextualback to summary
public ValueSerializer<?> createContextual(SerializationContext serializers, BeanProperty property)

Overrides tools.jackson.databind.ValueSerializer.createContextual.

Doc from tools.jackson.databind.ValueSerializer.createContextual.

Method called to see if a different (or differently configured) serializer is needed to serialize values of specified property (or, for root values, in which case `null` is passed). Note that instance that this method is called on is typically shared one and as a result method should NOT modify this instance but rather construct and return a new instance. This instance should only be returned as-is, in case it is already suitable for use.

Note that method is only called once per POJO property, and for the first usage as root value serializer; it is not called for every serialization, as doing that would have significant performance impact; most serializers cache contextual instances for future use.

Annotations
@Override
serializeback to summary
public void serialize(Object value, JsonGenerator g, 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 final void serializeWithType(Object value, JsonGenerator g, SerializationContext provider, TypeSerializer typeSer) throws JacksonException

Overrides tools.jackson.databind.ser.std.StdScalarSerializer.serializeWithType.

Doc from tools.jackson.databind.ser.std.StdScalarSerializer.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