Module tools.jackson.databind
Package tools.jackson.databind.ser.jdk
Class StringCollectionSerializer
java.lang.Object
tools.jackson.databind.ValueSerializer<T>
tools.jackson.databind.ser.std.StdSerializer<T>
tools.jackson.databind.ser.jdk.StaticListSerializerBase<Collection<String>>
tools.jackson.databind.ser.jdk.StringCollectionSerializer
- All Implemented Interfaces:
JsonFormatVisitable
Efficient implement for serializing
Collections that contain Strings.
The only complexity is due to possibility that serializer for String
may be override; because of this, logic is needed to ensure that the default
serializer is in use to use fastest mode, or if not, to defer to custom
String serializer.-
Nested Class Summary
Nested classes/interfaces inherited from class tools.jackson.databind.ValueSerializer
ValueSerializer.None -
Field Summary
FieldsFields inherited from class tools.jackson.databind.ser.jdk.StaticListSerializerBase
_rawElementType, _suppressableValue, _suppressNulls, _unwrapSingle, MARKER_FOR_EMPTYFields inherited from class tools.jackson.databind.ser.std.StdSerializer
_handledType -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedStringCollectionSerializer(StringCollectionSerializer src, Boolean unwrapSingle) Deprecated.protectedStringCollectionSerializer(StringCollectionSerializer src, Boolean unwrapSingle, Object suppressableValue, boolean suppressNulls) -
Method Summary
Modifier and TypeMethodDescription_withResolved(BeanProperty prop, Boolean unwrapSingle) Deprecated._withResolved(BeanProperty prop, Boolean unwrapSingle, Object suppressableValue, boolean suppressNulls) To support `@JsonInclude`.protected voidprotected JsonNodevoidserialize(Collection<String> value, tools.jackson.core.JsonGenerator g, SerializationContext ctxt) Method that can be called to ask implementation to serialize values of type this serializer handles.voidserializeWithType(Collection<String> value, tools.jackson.core.JsonGenerator g, SerializationContext ctxt, TypeSerializer typeSer) 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.Methods inherited from class tools.jackson.databind.ser.jdk.StaticListSerializerBase
_shouldSerializeElement, acceptJsonFormatVisitor, createContextual, isEmptyMethods inherited from class tools.jackson.databind.ser.std.StdSerializer
_neitherNull, _nonEmpty, _wrapIOFailure, acceptJsonFormatVisitorForBinary, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findContextualConvertingSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, handledType, isDefaultSerializer, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrowMethods inherited from class tools.jackson.databind.ValueSerializer
getDelegatee, isUnwrappingSerializer, properties, replaceDelegatee, resolve, unwrappingSerializer, usesObjectId, withFilterId, withFormatOverrides, withIgnoredProperties
-
Field Details
-
instance
-
-
Constructor Details
-
StringCollectionSerializer
protected StringCollectionSerializer() -
StringCollectionSerializer
@Deprecated protected StringCollectionSerializer(StringCollectionSerializer src, Boolean unwrapSingle) Deprecated. -
StringCollectionSerializer
protected StringCollectionSerializer(StringCollectionSerializer src, Boolean unwrapSingle, Object suppressableValue, boolean suppressNulls) - Since:
- 3.1
-
-
Method Details
-
_withResolved
Deprecated.- Specified by:
_withResolvedin classStaticListSerializerBase<Collection<String>>
-
_withResolved
public ValueSerializer<?> _withResolved(BeanProperty prop, Boolean unwrapSingle, Object suppressableValue, boolean suppressNulls) Description copied from class:StaticListSerializerBaseTo support `@JsonInclude`. Default implementation fallback toStaticListSerializerBase._withResolved(BeanProperty, Boolean, Object, boolean)- Overrides:
_withResolvedin classStaticListSerializerBase<Collection<String>>
-
contentSchema
- Specified by:
contentSchemain classStaticListSerializerBase<Collection<String>>
-
acceptContentVisitor
- Specified by:
acceptContentVisitorin classStaticListSerializerBase<Collection<String>>
-
serialize
public void serialize(Collection<String> value, tools.jackson.core.JsonGenerator g, SerializationContext ctxt) throws tools.jackson.core.JacksonException Description copied from class:ValueSerializerMethod that can be called to ask implementation to serialize values of type this serializer handles.- Specified by:
serializein classStdSerializer<Collection<String>>- Parameters:
value- Value to serialize; can not be null.g- Generator used to output resulting Json contentctxt- Context that can be used to get serializers for serializing Objects value contains, if any.- Throws:
tools.jackson.core.JacksonException
-
serializeWithType
public void serializeWithType(Collection<String> value, tools.jackson.core.JsonGenerator g, SerializationContext ctxt, TypeSerializer typeSer) throws tools.jackson.core.JacksonException Description copied from class:ValueSerializerMethod 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
UnsupportedOperationExceptionto 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, ctxt); typeSer.writeTypeSuffixForScalar(value, gen);
and implementations for type serialized as JSON Arrays or Objects would differ slightly, asSTART-ARRAY/END-ARRAYandSTART-OBJECT/END-OBJECTpairs need to be properly handled with respect to serializing of contents.- Specified by:
serializeWithTypein classStaticListSerializerBase<Collection<String>>- Parameters:
value- Value to serialize; can not be null.g- Generator used to output resulting Json contentctxt- Context that can be used to get serializers for serializing Objects value contains, if any.typeSer- Type serializer to use for including type information- Throws:
tools.jackson.core.JacksonException
-