Top Description Fields Constructors Methods
com.fasterxml.jackson.databind.ser

public abstract Class ContainerSerializer<T>

extends StdSerializer<T>
Class Inheritance
Known Direct Subclasses
com.fasterxml.jackson.databind.ser.impl.MapEntrySerializer, com.fasterxml.jackson.databind.ser.std.ArraySerializerBase, com.fasterxml.jackson.databind.ser.std.AsArraySerializerBase, com.fasterxml.jackson.databind.ser.std.MapSerializer
Annotations
@SuppressWarnings:serial
Imports
com.fasterxml.jackson.databind.*, com.fasterxml.jackson.databind.jsontype.TypeSerializer, com.fasterxml.jackson.databind.ser.std.StdSerializer

References Deprecated

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

See corresponding docs for further information.

Intermediate base class for serializers used for serializing types that contain element(s) of other types, such as arrays, java.util.Collections (Lists, Sets etc) and java.util.Maps and iterable things (java.util.Iterators).

Field Summary

Inherited from com.fasterxml.jackson.databind.ser.std.StdSerializer:
_handledType

Constructor Summary

AccessConstructor and Description
protected
protected
protected
ContainerSerializer(Class<?> t, boolean dummy)

Alternate constructor that is (alas!) needed to work around kinks of generic type handling

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

Method Summary

Modifier and TypeMethod and Description
protected abstract ContainerSerializer<?>
_withValueTypeSerializer(TypeSerializer vts)
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 JsonSerializer<?>
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 abstract JavaType
getContentType()

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

protected boolean
hasContentTypeAnnotation(SerializerProvider provider, BeanProperty property)
Deprecated Since 2.7: should not be needed; should be enough to see if type has 'isStatic' modifier

Helper method used to encapsulate logic for determining whether there is a property annotation that overrides element type; if so, we can and need to statically find the serializer.

public abstract boolean
hasSingleElement(T value)

Method called to determine if the given value (of type handled by this serializer) contains exactly one element.

public ContainerSerializer<?>

Returns:

Serializer instance that uses given type serializer for values if that is possible (or if not, just 'this' serializer)
withValueTypeSerializer
(TypeSerializer
Type serializer to use for contained values; can be null, in which case 'this' serializer is returned as is
vts
)
References Deprecated ContainerSerializer is deprecated or references (maybe indirectly) at least one deprecated element.

Factory(-like) method that can be used to construct a new container serializer that uses specified TypeSerializer for decorating contained values with additional type information.

Inherited from com.fasterxml.jackson.databind.ser.std.StdSerializer:
_neitherNull_nonEmptyacceptJsonFormatVisitorcreateSchemaNodecreateSchemaNodefindAnnotatedContentSerializerfindContextualConvertingSerializerfindConvertingContentSerializerfindFormatFeaturefindFormatOverridesfindIncludeOverridesfindPropertyFiltergetSchemagetSchemahandledTypeisDefaultSerializerserializevisitArrayFormatvisitArrayFormatvisitFloatFormatvisitIntFormatvisitIntFormatvisitStringFormatvisitStringFormatwrapAndThrowwrapAndThrow

Constructor Detail

ContainerSerializerback to summary
protected ContainerSerializer(Class<T> t)
ContainerSerializerback to summary
protected ContainerSerializer(JavaType fullType)
Since
2.5
ContainerSerializerback to summary
protected ContainerSerializer(Class<?> t, boolean dummy)

Alternate constructor that is (alas!) needed to work around kinks of generic type handling

ContainerSerializerback to summary
protected ContainerSerializer(ContainerSerializer<?> src)

References Deprecated

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

See corresponding docs for further information.

Method Detail

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

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.

getContentSerializerback to summary
public abstract JsonSerializer<?> 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.

getContentTypeback to summary
public abstract JavaType getContentType()

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

hasContentTypeAnnotationback to summary
protected boolean hasContentTypeAnnotation(SerializerProvider provider, BeanProperty property)

Deprecated

Since 2.7: should not be needed; should be enough to see if type has 'isStatic' modifier

Helper method used to encapsulate logic for determining whether there is a property annotation that overrides element type; if so, we can and need to statically find the serializer.

Annotations
@Deprecated
Since
2.1
hasSingleElementback to summary
public abstract boolean hasSingleElement(T value)

Method called to determine if the given value (of type handled by this serializer) contains exactly one element.

Note

although it might seem sensible to instead define something like "getElementCount()" method, this would not work well for containers that do not keep track of size (like linked lists may not).

Note, too, that as of now (2.9) this method is only called by serializer itself; and specifically is not used for non-array/collection types like Map or Map.Entry instances.

withValueTypeSerializerback to summary
public ContainerSerializer<?> withValueTypeSerializer(TypeSerializer vts)

References Deprecated

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

See corresponding docs for further information.

Factory(-like) method that can be used to construct a new container serializer that uses specified TypeSerializer for decorating contained values with additional type information.

Parameters
vts:TypeSerializer

Type serializer to use for contained values; can be null, in which case 'this' serializer is returned as is

Returns:ContainerSerializer<?>

Serializer instance that uses given type serializer for values if that is possible (or if not, just 'this' serializer)