Top Description Inners Methods
tools.jackson.databind

public Interface JacksonSerializable

Known Direct Implementers
tools.jackson.databind.JacksonSerializable.Base, tools.jackson.databind.type.TypeBase, tools.jackson.databind.util.JSONPObject, tools.jackson.databind.util.JSONWrappedObject, tools.jackson.databind.util.RawValue
Imports
tools.jackson.core.*, tools.jackson.databind.jsontype.TypeSerializer

Interface that can be implemented by objects that know how to serialize themselves to JSON, using JsonGenerator (and SerializationContext if necessary).

Note that implementing this interface binds implementing object closely to Jackson API, and that it is often not necessary to do so -- if class is a bean, it can be serialized without implementing this interface.

Note that while it is possible to just directly implement JacksonSerializable, actual implementations are strongly recommended to instead extend JacksonSerializable.Base.

Note

in Jackson 2.x this type was named JsonSerializable

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
JacksonSerializable.Base

Base class with minimal implementation, as well as couple of extension methods that core Jackson databinding makes use of.

Method Summary

Modifier and TypeMethod and Description
public void
serialize(JsonGenerator gen, SerializationContext serializers)

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

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

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

Method Detail

serializeback to summary
public void serialize(JsonGenerator gen, SerializationContext serializers) throws JacksonException

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

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

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.

tools.jackson.databind back to summary

public abstract Class JacksonSerializable.Base

extends Object
implements JacksonSerializable
Class Inheritance
All Implemented Interfaces
tools.jackson.databind.JacksonSerializable
Known Direct Subclasses
tools.jackson.databind.JsonNode, tools.jackson.databind.node.InternalNodeSerializer.WrapperForSerializer

Base class with minimal implementation, as well as couple of extension methods that core Jackson databinding makes use of. Use of this base class is strongly recommended over directly implementing JacksonSerializable.

Constructor Summary

AccessConstructor and Description
public
Base()

Method Summary

Modifier and TypeMethod and Description
public boolean
isEmpty(SerializationContext serializers)

Method that may be called on instance to determine if it is considered "empty" for purposes of serialization filtering or not.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Baseback to summary
public Base()

Method Detail

isEmptyback to summary
public boolean isEmpty(SerializationContext serializers)

Method that may be called on instance to determine if it is considered "empty" for purposes of serialization filtering or not.