Class ContainerSerializer<T>
java.lang.Object
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.JsonSerializer<T>
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.ser.std.StdSerializer<T>
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.ser.ContainerSerializer<T>
- All Implemented Interfaces:
JsonFormatVisitable
,SchemaAware
,Serializable
- Direct Known Subclasses:
ArraySerializerBase
,AsArraySerializerBase
,MapEntrySerializer
,MapSerializer
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).- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.JsonSerializer
JsonSerializer.None
-
Field Summary
Fields inherited from class edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.ser.std.StdSerializer
_handledType
-
Constructor Summary
ModifierConstructorDescriptionprotected
ContainerSerializer
(JavaType fullType) protected
protected
ContainerSerializer
(Class<?> t, boolean dummy) Alternate constructor that is (alas!) needed to work around kinks of generic type handlingprotected
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ContainerSerializer<?>
Method that needs to be implemented to allow construction of a new serializer object with givenTypeSerializer
, used when addition type information is to be embedded.abstract JsonSerializer<?>
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
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' modifierabstract boolean
hasSingleElement
(T value) Method called to determine if the given value (of type handled by this serializer) contains exactly one element.Factory(-like) method that can be used to construct a new container serializer that uses specifiedTypeSerializer
for decorating contained values with additional type information.Methods inherited from class edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.ser.std.StdSerializer
_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
Methods inherited from class edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.JsonSerializer
getDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, serializeWithType, unwrappingSerializer, usesObjectId, withFilterId
-
Constructor Details
-
ContainerSerializer
-
ContainerSerializer
- Since:
- 2.5
-
ContainerSerializer
Alternate constructor that is (alas!) needed to work around kinks of generic type handling- Parameters:
t
-
-
ContainerSerializer
-
-
Method Details
-
withValueTypeSerializer
Factory(-like) method that can be used to construct a new container serializer that uses specifiedTypeSerializer
for decorating contained values with additional type information.- Parameters:
vts
- Type serializer to use for contained values; can be null, in which case 'this' serializer is returned as is- Returns:
- Serializer instance that uses given type serializer for values if that is possible (or if not, just 'this' serializer)
-
getContentType
Accessor for finding declared (static) element type for type this serializer is used for. -
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 usegetContentType()
andSerializerProvider.findContentValueSerializer(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.JavaType, edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.BeanProperty)
. -
hasSingleElement
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
orMap.Entry
instances. -
_withValueTypeSerializer
Method that needs to be implemented to allow construction of a new serializer object with givenTypeSerializer
, used when addition type information is to be embedded. -
hasContentTypeAnnotation
@Deprecated protected boolean hasContentTypeAnnotation(SerializerProvider provider, BeanProperty property) Deprecated.Since 2.7: should not be needed; should be enough to see if type has 'isStatic' modifierHelper 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.- Since:
- 2.1
-