Class IndexedStringListSerializer
java.lang.Object
tools.jackson.databind.ValueSerializer<List<String>>
tools.jackson.databind.ser.std.StdSerializer<List<String>>
tools.jackson.databind.ser.jdk.StaticListSerializerBase<List<String>>
tools.jackson.databind.ser.jdk.IndexedStringListSerializer
- All Implemented Interfaces:
JsonFormatVisitable
Efficient implement for serializing
Lists that contains Strings and are random-accessible.
The only complexity is due to possibility that serializer for String
may be overridde; 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 ValueSerializer
ValueSerializer.None -
Field Summary
FieldsFields inherited from class StaticListSerializerBase
_rawElementType, _suppressableValue, _suppressNulls, _unwrapSingle, MARKER_FOR_EMPTYFields inherited from class StdSerializer
_handledType -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedIndexedStringListSerializer(IndexedStringListSerializer src, Boolean unwrapSingle) Deprecated.IndexedStringListSerializer(IndexedStringListSerializer src, Boolean unwrapSingle, Object suppressableValue, boolean suppressNulls) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean_withResolved(BeanProperty prop, Boolean unwrapSingle) Deprecated._withResolved(BeanProperty prop, Boolean unwrapSingle, Object suppressableValue, boolean suppressNulls) To support `@JsonInclude`.protected voidprotected JsonNodevoidserialize(List<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.private final voidserializeContentsFiltered(List<String> value, tools.jackson.core.JsonGenerator g, SerializationContext ctxt, int len) private final voidserializeContentsNonFiltered(List<String> value, tools.jackson.core.JsonGenerator g, SerializationContext ctxt, int len) voidserializeWithType(List<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 StaticListSerializerBase
_shouldSerializeElement, acceptJsonFormatVisitor, createContextual, isEmptyMethods inherited from class 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 ValueSerializer
getDelegatee, isUnwrappingSerializer, properties, replaceDelegatee, resolve, unwrappingSerializer, usesObjectId, withFilterId, withFormatOverrides, withIgnoredProperties
-
Field Details
-
instance
-
-
Constructor Details
-
IndexedStringListSerializer
protected IndexedStringListSerializer() -
IndexedStringListSerializer
@Deprecated public IndexedStringListSerializer(IndexedStringListSerializer src, Boolean unwrapSingle) Deprecated. -
IndexedStringListSerializer
public IndexedStringListSerializer(IndexedStringListSerializer src, Boolean unwrapSingle, Object suppressableValue, boolean suppressNulls) - Since:
- 3.1
-
-
Method Details
-
_withResolved
Deprecated.- Specified by:
_withResolvedin classStaticListSerializerBase<List<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<List<String>>
-
contentSchema
- Specified by:
contentSchemain classStaticListSerializerBase<List<String>>
-
acceptContentVisitor
- Specified by:
acceptContentVisitorin classStaticListSerializerBase<List<String>>
-
serialize
public void serialize(List<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<List<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(List<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<List<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
-
serializeContentsNonFiltered
private final void serializeContentsNonFiltered(List<String> value, tools.jackson.core.JsonGenerator g, SerializationContext ctxt, int len) throws tools.jackson.core.JacksonException - Throws:
tools.jackson.core.JacksonException
-
serializeContentsFiltered
private final void serializeContentsFiltered(List<String> value, tools.jackson.core.JsonGenerator g, SerializationContext ctxt, int len) throws tools.jackson.core.JacksonException - Throws:
tools.jackson.core.JacksonException
-
_needToCheckFiltering
-