public abstract class ContainerSerializer<T> extends StdSerializer<T>
Collection
s (Lists
, Sets
etc) and Map
s and iterable things
(Iterator
s).JsonSerializer.None
_handledType
Modifier | Constructor and Description |
---|---|
protected |
ContainerSerializer(Class<?> t,
boolean dummy)
Alternate constructor that is (alas!) needed to work
around kinks of generic type handling
|
protected |
ContainerSerializer(Class<T> t) |
protected |
ContainerSerializer(ContainerSerializer<?> src) |
protected |
ContainerSerializer(JavaType fullType) |
Modifier and Type | Method and Description |
---|---|
protected abstract ContainerSerializer<?> |
_withValueTypeSerializer(TypeSerializer vts)
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. |
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.
|
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
|
abstract boolean |
hasSingleElement(T value)
Method called to determine if the given value (of type handled by
this serializer) contains exactly one element.
|
ContainerSerializer<?> |
withValueTypeSerializer(TypeSerializer vts)
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. |
_neitherNull, _nonEmpty, acceptJsonFormatVisitor, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findContextualConvertingSerializer, findConvertingContentSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, getSchema, getSchema, handledType, isDefaultSerializer, serialize, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrow
getDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, serializeWithType, unwrappingSerializer, usesObjectId, withFilterId
protected ContainerSerializer(JavaType fullType)
protected ContainerSerializer(Class<?> t, boolean dummy)
t
- protected ContainerSerializer(ContainerSerializer<?> src)
public ContainerSerializer<?> withValueTypeSerializer(TypeSerializer vts)
TypeSerializer
for decorating
contained values with additional type information.vts
- Type serializer to use for contained values; can be null,
in which case 'this' serializer is returned as ispublic abstract JavaType getContentType()
public abstract JsonSerializer<?> getContentSerializer()
getContentType()
and
SerializerProvider.findContentValueSerializer(com.fasterxml.jackson.databind.JavaType, com.fasterxml.jackson.databind.BeanProperty)
.public abstract boolean hasSingleElement(T value)
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.
protected abstract ContainerSerializer<?> _withValueTypeSerializer(TypeSerializer vts)
TypeSerializer
, used when
addition type information is to be embedded.@Deprecated protected boolean hasContentTypeAnnotation(SerializerProvider provider, BeanProperty property)
Copyright © 2008–2022 FasterXML. All rights reserved.