Top Description Inners Fields Constructors Methods
tools.jackson.databind.node

pack-priv Class InternalNodeSerializer

extends Object
Class Inheritance
Imports
java.util.Arrays, .Iterator, .Map, tools.jackson.core.JacksonException, .JsonGenerator, tools.jackson.databind.*, tools.jackson.databind.json.JsonMapper, tools.jackson.databind.jsontype.TypeSerializer

Helper class used to support non-recursive serialization for use by BaseJsonNode#toString (and related) method.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
InternalNodeSerializer.IteratorStack

Optimized variant similar in functionality to (a subset of) java.util.ArrayDeque; used to hold enclosing Array/Object nodes during recursion-as-iteration.

protected static class
InternalNodeSerializer.WrapperForSerializer

Intermediate serializer we need to implement non-recursive serialization of BaseJsonNode

Field Summary

Modifier and TypeField and Description
private static final ObjectWriter
private static final JsonMapper
private static final ObjectWriter

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static JacksonSerializable
public static String
public static String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

COMPACT_WRITERback to summary
private static final ObjectWriter COMPACT_WRITER
MAPPERback to summary
private static final JsonMapper MAPPER
PRETTY_WRITERback to summary
private static final ObjectWriter PRETTY_WRITER

Constructor Detail

InternalNodeSerializerback to summary
pack-priv InternalNodeSerializer()

Method Detail

_wrapperback to summary
private static JacksonSerializable _wrapper(BaseJsonNode root)
toPrettyStringback to summary
public static String toPrettyString(BaseJsonNode root)
toStringback to summary
public static String toString(BaseJsonNode root)
tools.jackson.databind.node back to summary

pack-priv final Class InternalNodeSerializer.IteratorStack

extends Object
Class Inheritance
  • java.lang.Object
  • tools.jackson.databind.node.InternalNodeSerializer.IteratorStack

Optimized variant similar in functionality to (a subset of) java.util.ArrayDeque; used to hold enclosing Array/Object nodes during recursion-as-iteration.

Field Summary

Modifier and TypeField and Description
private int
private Iterator<?>[]
private int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Iterator<?>
public void
push(Iterator<?> it)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_endback to summary
private int _end
_stackback to summary
private Iterator<?>[] _stack
_topback to summary
private int _top

Constructor Detail

IteratorStackback to summary
public IteratorStack()

Method Detail

popOrNullback to summary
public Iterator<?> popOrNull()
pushback to summary
public void push(Iterator<?> it)
tools.jackson.databind.node back to summary

protected Class InternalNodeSerializer.WrapperForSerializer

extends Base
Class Inheritance

Intermediate serializer we need to implement non-recursive serialization of BaseJsonNode

Field Summary

Modifier and TypeField and Description
protected SerializationContext
protected final BaseJsonNode

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
protected void
public void
serialize(JsonGenerator g, SerializationContext ctxt)

Implements tools.jackson.databind.JacksonSerializable.serialize.

Serialization method called when no additional type information is to be included in serialization.

public void
serializeWithType(JsonGenerator gen, SerializationContext serializers, TypeSerializer typeSer)

Implements tools.jackson.databind.JacksonSerializable.serializeWithType.

Serialization method called when additional type information is expected to be included in serialization, for deserialization to use.

Inherited from tools.jackson.databind.JacksonSerializable.Base:
isEmpty

Field Detail

_contextback to summary
protected SerializationContext _context
_rootback to summary
protected final BaseJsonNode _root

Constructor Detail

WrapperForSerializerback to summary
public WrapperForSerializer(BaseJsonNode root)

Method Detail

_serializeNonRecursiveback to summary
protected void _serializeNonRecursive(JsonGenerator g, JsonNode node) throws JacksonException
_serializeNonRecursiveback to summary
protected void _serializeNonRecursive(JsonGenerator g, InternalNodeSerializer.IteratorStack stack, final Iterator<?> rootIterator) throws JacksonException
serializeback to summary
public void serialize(JsonGenerator g, SerializationContext ctxt) throws JacksonException

Implements tools.jackson.databind.JacksonSerializable.serialize.

Doc from tools.jackson.databind.JacksonSerializable.serialize.

Serialization method called when no additional type information is to be included in serialization.

Annotations
@Override
serializeWithTypeback to summary
public void serializeWithType(JsonGenerator gen, SerializationContext serializers, TypeSerializer typeSer) throws JacksonException

Implements tools.jackson.databind.JacksonSerializable.serializeWithType.

Doc from tools.jackson.databind.JacksonSerializable.serializeWithType.

Serialization method called when additional type information is expected to be included in serialization, for deserialization to use.

Usually implementation consists of a call to TypeSerializer#writeTypePrefix followed by serialization of contents, followed by a call to TypeSerializer#writeTypeSuffix). Details of the type id argument to pass depend on shape of JSON Object used (Array, Object or scalar like String/Number/Boolean).

Note that some types (most notably, "natural" types: String, Integer, Double and Boolean) never include type information.

Annotations
@Override