Top Description Fields Constructors Methods
com.fasterxml.jackson.datatype.hppc.ser

public abstract Class ContainerSerializerBase<T>

extends ContainerSerializer<T>
Class Inheritance
Known Direct Subclasses
com.fasterxml.jackson.datatype.hppc.ser.HppcContainerSerializers.ByteContainerSerializer, com.fasterxml.jackson.datatype.hppc.ser.HppcContainerSerializers.ShortContainerSerializer, com.fasterxml.jackson.datatype.hppc.ser.HppcContainerSerializers.IntContainerSerializer, com.fasterxml.jackson.datatype.hppc.ser.HppcContainerSerializers.IntContainerSerializer.Indexed, com.fasterxml.jackson.datatype.hppc.ser.HppcContainerSerializers.LongContainerSerializer, com.fasterxml.jackson.datatype.hppc.ser.HppcContainerSerializers.CharContainerSerializer, com.fasterxml.jackson.datatype.hppc.ser.HppcContainerSerializers.FloatContainerSerializer, com.fasterxml.jackson.datatype.hppc.ser.HppcContainerSerializers.DoubleContainerSerializer, com.fasterxml.jackson.datatype.hppc.ser.HppcContainerSerializers.BitSetSerializer, com.fasterxml.jackson.datatype.hppc.ser.ObjectContainerSerializer
Imports
java.io.IOException, java.lang.reflect.Type, com.fasterxml.jackson.core.*, com.fasterxml.jackson.core.type.WritableTypeId, com.fasterxml.jackson.databind.*, com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper, com.fasterxml.jackson.databind.jsontype.TypeSerializer, com.fasterxml.jackson.databind.node.ObjectNode, com.fasterxml.jackson.databind.ser.ContainerSerializer

References Deprecated

ContainerSerializer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Base class for various container (~= Collection) serializers.

Field Summary

Modifier and TypeField and Description
protected final String
private static final long

Constructor Summary

AccessConstructor and Description
protected
ContainerSerializerBase(Class<T> type, String schemaElementType)

protected
ContainerSerializerBase(JavaType type, String schemaElementType)

protected
ContainerSerializerBase(ContainerSerializerBase<?> src)
References Deprecated ContainerSerializerBase is deprecated or references (maybe indirectly) at least one deprecated element.

Method Summary

Modifier and TypeMethod and Description
protected ContainerSerializer<?>
_withValueTypeSerializer(TypeSerializer vts)

Implements abstract com.fasterxml.jackson.databind.ser.ContainerSerializer._withValueTypeSerializer.

References Deprecated ContainerSerializer is deprecated or references (maybe indirectly) at least one deprecated element.

Method that needs to be implemented to allow construction of a new serializer object with given TypeSerializer, used when addition type information is to be embedded.

public abstract void
public JsonSerializer<?>
getContentSerializer()

Implements abstract com.fasterxml.jackson.databind.ser.ContainerSerializer.getContentSerializer.

Accessor for serializer used for serializing contents (List and array elements, Map values etc) of the container for which this serializer is used, if it is known statically.

public JavaType
getContentType()

Implements abstract com.fasterxml.jackson.databind.ser.ContainerSerializer.getContentType.

Accessor for finding declared (static) element type for type this serializer is used for.

public JsonNode
getSchema(SerializerProvider
The serializer provider.
provider
,
Type
A hint about the type.
typeHint
)

Overrides com.fasterxml.jackson.databind.ser.std.StdSerializer.getSchema.

Implements com.fasterxml.jackson.databind.jsonschema.SchemaAware.getSchema.

Default implementation simply claims type is "string"; usually overriden by custom serializers.

protected JsonSerializer<?>
public abstract boolean
isEmpty(SerializerProvider provider, T value)

Overrides com.fasterxml.jackson.databind.JsonSerializer.isEmpty.

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

public void
serialize(T
Value to serialize; can not be null.
value
,
JsonGenerator
Generator used to output resulting Json content
gen
,
SerializerProvider
Provider that can be used to get serializers for serializing Objects value contains, if any.
provider
)

Implements abstract com.fasterxml.jackson.databind.ser.std.StdSerializer.serialize.

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

protected abstract void
public void
serializeWithType(T
Value to serialize; can not be null.
value
,
JsonGenerator
Generator used to output resulting Json content
gen
,
SerializerProvider
Provider that can be used to get serializers for serializing Objects value contains, if any.
provider
,
TypeSerializer
Type serializer to use for including type information
typeSer
)

Overrides com.fasterxml.jackson.databind.JsonSerializer.serializeWithType.

Method that can be called to ask implementation to serialize values of type this serializer handles, using specified type serializer for embedding necessary type information.

Inherited from com.fasterxml.jackson.databind.ser.ContainerSerializer:
hasContentTypeAnnotationhasSingleElementwithValueTypeSerializer

Field Detail

_schemeElementTypeback to summary
protected final String _schemeElementType
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.databind.ser.std.StdSerializer.serialVersionUID.

Constructor Detail

ContainerSerializerBaseback to summary
protected ContainerSerializerBase(Class<T> type, String schemaElementType)
ContainerSerializerBaseback to summary
protected ContainerSerializerBase(JavaType type, String schemaElementType)
ContainerSerializerBaseback to summary
protected ContainerSerializerBase(ContainerSerializerBase<?> src)

References Deprecated

ContainerSerializerBase is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Method Detail

_withValueTypeSerializerback to summary
protected ContainerSerializer<?> _withValueTypeSerializer(TypeSerializer vts)

Implements abstract com.fasterxml.jackson.databind.ser.ContainerSerializer._withValueTypeSerializer.

Doc from com.fasterxml.jackson.databind.ser.ContainerSerializer._withValueTypeSerializer.

References Deprecated

ContainerSerializer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Method that needs to be implemented to allow construction of a new serializer object with given TypeSerializer, used when addition type information is to be embedded.

Annotations
@Override
acceptJsonFormatVisitorback to summary
public abstract void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException

Redeclares com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable.acceptJsonFormatVisitor.

Overrides com.fasterxml.jackson.databind.ser.std.StdSerializer.acceptJsonFormatVisitor.

Doc from com.fasterxml.jackson.databind.ser.std.StdSerializer.acceptJsonFormatVisitor.

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

Parameters
typeHint:JavaType

Doc from com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable.acceptJsonFormatVisitor.

Type of element (entity like property) being visited

Annotations
@Override
getContentSerializerback to summary
public JsonSerializer<?> getContentSerializer()

Implements abstract com.fasterxml.jackson.databind.ser.ContainerSerializer.getContentSerializer.

Doc from com.fasterxml.jackson.databind.ser.ContainerSerializer.getContentSerializer.

Accessor for serializer used for serializing contents (List and array elements, Map values etc) of the container for which this serializer is used, if it is known statically. Note that for dynamic types this may return null; if so, caller has to instead use getContentType() and com.fasterxml.jackson.databind.SerializerProvider#findContentValueSerializer.

Annotations
@Override
getContentTypeback to summary
public JavaType getContentType()

Implements abstract com.fasterxml.jackson.databind.ser.ContainerSerializer.getContentType.

Doc from com.fasterxml.jackson.databind.ser.ContainerSerializer.getContentType.

Accessor for finding declared (static) element type for type this serializer is used for.

Annotations
@Override
getSchemaback to summary
public JsonNode getSchema(SerializerProvider provider, Type typeHint)

Overrides com.fasterxml.jackson.databind.ser.std.StdSerializer.getSchema.

Implements com.fasterxml.jackson.databind.jsonschema.SchemaAware.getSchema.

Doc from com.fasterxml.jackson.databind.ser.std.StdSerializer.getSchema.

Default implementation simply claims type is "string"; usually overriden by custom serializers.

Parameters
provider:SerializerProvider

Doc from com.fasterxml.jackson.databind.jsonschema.SchemaAware.getSchema.

The serializer provider.

typeHint:Type

Doc from com.fasterxml.jackson.databind.jsonschema.SchemaAware.getSchema.

A hint about the type.

Returns:JsonNode

Doc from com.fasterxml.jackson.databind.jsonschema.SchemaAware.getSchema.

Json-schema for this serializer.

Annotations
@Override
getSerializerback to summary
protected JsonSerializer<?> getSerializer(JavaType type)
isEmptyback to summary
public abstract boolean isEmpty(SerializerProvider provider, T value)

Overrides com.fasterxml.jackson.databind.JsonSerializer.isEmpty.

Doc from com.fasterxml.jackson.databind.JsonSerializer.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.

Note

replaces isEmpty(Object), which was deprecated in 2.5

Annotations
@Override
serializeback to summary
public void serialize(T value, JsonGenerator gen, SerializerProvider provider) throws IOException

Implements abstract com.fasterxml.jackson.databind.ser.std.StdSerializer.serialize.

Doc from com.fasterxml.jackson.databind.JsonSerializer.serialize.

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

Parameters
value:T

Value to serialize; can not be null.

gen:JsonGenerator

Generator used to output resulting Json content

provider:SerializerProvider

Provider that can be used to get serializers for serializing Objects value contains, if any.

Annotations
@Override
serializeContentsback to summary
protected abstract void serializeContents(T value, JsonGenerator gen, SerializerProvider provider) throws IOException
serializeWithTypeback to summary
public void serializeWithType(T value, JsonGenerator gen, SerializerProvider provider, TypeSerializer typeSer) throws IOException

Overrides com.fasterxml.jackson.databind.JsonSerializer.serializeWithType.

Doc from com.fasterxml.jackson.databind.JsonSerializer.serializeWithType.

Method that can be called to ask implementation to serialize values of type this serializer handles, using specified type serializer for embedding necessary type information.

Default implementation will throw UnsupportedOperationException to indicate that proper type handling needs to be implemented.

For simple datatypes written as a single scalar value (JSON String, Number, Boolean), implementation would look like:

  // note: method to call depends on whether this type is serialized as JSON scalar, object or Array!
  typeSer.writeTypePrefixForScalar(value, gen);
  serialize(value, gen, provider);
  typeSer.writeTypeSuffixForScalar(value, gen);
and implementations for type serialized as JSON Arrays or Objects would differ slightly, as START-ARRAY/END-ARRAY and START-OBJECT/END-OBJECT pairs need to be properly handled with respect to serializing of contents.
Parameters
value:T

Value to serialize; can not be null.

gen:JsonGenerator

Generator used to output resulting Json content

provider:SerializerProvider

Provider that can be used to get serializers for serializing Objects value contains, if any.

typeSer:TypeSerializer

Type serializer to use for including type information

Annotations
@Override