Class IiifIndexedListSerializer

  • All Implemented Interfaces:
    com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable, com.fasterxml.jackson.databind.jsonschema.SchemaAware, com.fasterxml.jackson.databind.ser.ContextualSerializer, Serializable

    public final class IiifIndexedListSerializer
    extends com.fasterxml.jackson.databind.ser.std.AsArraySerializerBase<List<?>>
    This is a custom serializer for `List<Object>` that has some special cases required by the IIIF specification, namely that some fields should not be encoded as arrays if they only contain a single element.

    Apart from this, the code is identical to IndexedListSerializer and delegates to it where possible.

    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer

        com.fasterxml.jackson.databind.JsonSerializer.None
    • Field Summary

      • Fields inherited from class com.fasterxml.jackson.databind.ser.std.AsArraySerializerBase

        _dynamicSerializers, _elementSerializer, _elementType, _property, _staticTyping, _unwrapSingle, _valueTypeSerializer
      • Fields inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer

        _handledType
    • Constructor Summary

      Constructors 
      Constructor Description
      IiifIndexedListSerializer​(com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer defaultSerializer, com.fasterxml.jackson.databind.type.TypeFactory tf)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected com.fasterxml.jackson.databind.ser.ContainerSerializer<?> _withValueTypeSerializer​(com.fasterxml.jackson.databind.jsontype.TypeSerializer vts)  
      boolean hasSingleElement​(List<?> value)  
      void serialize​(List<?> value, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider provider)  
      protected void serializeContents​(List<?> value, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider provider)  
      com.fasterxml.jackson.databind.ser.std.AsArraySerializerBase<List<?>> withResolved​(com.fasterxml.jackson.databind.BeanProperty property, com.fasterxml.jackson.databind.jsontype.TypeSerializer vts, com.fasterxml.jackson.databind.JsonSerializer<?> elementSerializer, Boolean unwrapSingle)  
      • Methods inherited from class com.fasterxml.jackson.databind.ser.std.AsArraySerializerBase

        _findAndAddDynamic, _findAndAddDynamic, acceptJsonFormatVisitor, createContextual, getContentSerializer, getContentType, getSchema, serializeWithType, withResolved
      • Methods inherited from class com.fasterxml.jackson.databind.ser.ContainerSerializer

        hasContentTypeAnnotation, withValueTypeSerializer
      • Methods inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer

        _neitherNull, _nonEmpty, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findContextualConvertingSerializer, findConvertingContentSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, getSchema, handledType, isDefaultSerializer, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrow
      • Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer

        getDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, unwrappingSerializer, usesObjectId, withFilterId
    • Constructor Detail

      • IiifIndexedListSerializer

        public IiifIndexedListSerializer​(com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer defaultSerializer,
                                         com.fasterxml.jackson.databind.type.TypeFactory tf)
    • Method Detail

      • withResolved

        public com.fasterxml.jackson.databind.ser.std.AsArraySerializerBase<List<?>> withResolved​(com.fasterxml.jackson.databind.BeanProperty property,
                                                                                                  com.fasterxml.jackson.databind.jsontype.TypeSerializer vts,
                                                                                                  com.fasterxml.jackson.databind.JsonSerializer<?> elementSerializer,
                                                                                                  Boolean unwrapSingle)
        Specified by:
        withResolved in class com.fasterxml.jackson.databind.ser.std.AsArraySerializerBase<List<?>>
      • serialize

        public final void serialize​(List<?> value,
                                    com.fasterxml.jackson.core.JsonGenerator gen,
                                    com.fasterxml.jackson.databind.SerializerProvider provider)
                             throws IOException
        Overrides:
        serialize in class com.fasterxml.jackson.databind.ser.std.AsArraySerializerBase<List<?>>
        Throws:
        IOException
      • serializeContents

        protected void serializeContents​(List<?> value,
                                         com.fasterxml.jackson.core.JsonGenerator gen,
                                         com.fasterxml.jackson.databind.SerializerProvider provider)
                                  throws IOException
        Specified by:
        serializeContents in class com.fasterxml.jackson.databind.ser.std.AsArraySerializerBase<List<?>>
        Throws:
        IOException
      • hasSingleElement

        public boolean hasSingleElement​(List<?> value)
        Specified by:
        hasSingleElement in class com.fasterxml.jackson.databind.ser.ContainerSerializer<List<?>>
      • _withValueTypeSerializer

        protected com.fasterxml.jackson.databind.ser.ContainerSerializer<?> _withValueTypeSerializer​(com.fasterxml.jackson.databind.jsontype.TypeSerializer vts)
        Specified by:
        _withValueTypeSerializer in class com.fasterxml.jackson.databind.ser.ContainerSerializer<List<?>>