Class IndexedStringListSerializer

All Implemented Interfaces:
JsonFormatVisitable

public final class IndexedStringListSerializer extends StaticListSerializerBase<List<String>>
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.
  • Field Details

  • Constructor Details

  • Method Details

    • _withResolved

      @Deprecated public ValueSerializer<?> _withResolved(BeanProperty prop, Boolean unwrapSingle)
      Deprecated.
      Specified by:
      _withResolved in class StaticListSerializerBase<List<String>>
    • _withResolved

      public ValueSerializer<?> _withResolved(BeanProperty prop, Boolean unwrapSingle, Object suppressableValue, boolean suppressNulls)
      Description copied from class: StaticListSerializerBase
      To support `@JsonInclude`. Default implementation fallback to StaticListSerializerBase._withResolved(BeanProperty, Boolean, Object, boolean)
      Overrides:
      _withResolved in class StaticListSerializerBase<List<String>>
    • contentSchema

      protected JsonNode contentSchema()
      Specified by:
      contentSchema in class StaticListSerializerBase<List<String>>
    • acceptContentVisitor

      protected void acceptContentVisitor(JsonArrayFormatVisitor visitor)
      Specified by:
      acceptContentVisitor in class StaticListSerializerBase<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: ValueSerializer
      Method that can be called to ask implementation to serialize values of type this serializer handles.
      Specified by:
      serialize in class StdSerializer<List<String>>
      Parameters:
      value - Value to serialize; can not be null.
      g - Generator used to output resulting Json content
      ctxt - 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: ValueSerializer
      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.

      Default implementation will throw UnsupportedOperationException to 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, as START-ARRAY/END-ARRAY and START-OBJECT/END-OBJECT pairs need to be properly handled with respect to serializing of contents.
      Specified by:
      serializeWithType in class StaticListSerializerBase<List<String>>
      Parameters:
      value - Value to serialize; can not be null.
      g - Generator used to output resulting Json content
      ctxt - 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

      protected boolean _needToCheckFiltering(SerializationContext ctxt)