|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.fasterxml.jackson.databind.JsonSerializer<T> com.fasterxml.jackson.databind.ser.std.StdSerializer<T> com.fasterxml.jackson.databind.ser.ContainerSerializer<T>
public abstract class ContainerSerializer<T>
Intermediate base class for serializers used for serializing
types that contain element(s) of other types, such as arrays,
Collection
s (Lists
, Sets
etc) and Map
s and iterable things
(Iterator
s).
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer |
---|
JsonSerializer.None |
Field Summary |
---|
Fields inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer |
---|
_handledType |
Constructor Summary | |
---|---|
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)
|
Method Summary | |
---|---|
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)
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. |
abstract boolean |
hasSingleElement(T value)
Method called to determine if the given value (of type handled by this serializer) contains exactly one element. |
abstract boolean |
isEmpty(T value)
Method called to check whether given serializable value is considered "empty" value (for purposes of suppressing serialization of empty values). |
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. |
Methods inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer |
---|
acceptJsonFormatVisitor, createObjectNode, createSchemaNode, createSchemaNode, getSchema, getSchema, handledType, isDefaultSerializer, serialize, wrapAndThrow, wrapAndThrow |
Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer |
---|
getDelegatee, isUnwrappingSerializer, replaceDelegatee, serializeWithType, unwrappingSerializer, usesObjectId |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ContainerSerializer(Class<T> t)
protected ContainerSerializer(Class<?> t, boolean dummy)
t
- protected ContainerSerializer(ContainerSerializer<?> src)
Method Detail |
---|
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 is
public abstract JavaType getContentType()
public abstract JsonSerializer<?> getContentSerializer()
getContentType()
and
SerializerProvider.findValueSerializer(java.lang.Class>, com.fasterxml.jackson.databind.BeanProperty)
.
public abstract boolean isEmpty(T value)
JsonSerializer
Default implementation will consider only null values to be empty.
isEmpty
in class JsonSerializer<T>
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).
protected abstract ContainerSerializer<?> _withValueTypeSerializer(TypeSerializer vts)
TypeSerializer
, used when
addition type information is to be embedded.
protected boolean hasContentTypeAnnotation(SerializerProvider provider, BeanProperty property)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |