com.fasterxml.jackson.databind.ser

Class ContainerSerializer<T>

    • Constructor Detail

      • ContainerSerializer

        protected ContainerSerializer(Class<T> t)
      • ContainerSerializer

        protected ContainerSerializer(Class<?> t,
                           boolean dummy)
        Alternate constructor that is (alas!) needed to work around kinks of generic type handling
        Parameters:
        t -
    • Method Detail

      • withValueTypeSerializer

        public ContainerSerializer<?> withValueTypeSerializer(TypeSerializer vts)
        Factory(-like) method that can be used to construct a new container serializer that uses specified TypeSerializer 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

        public abstract JavaType getContentType()
        Accessor for finding declared (static) element type for type this serializer is used for.
      • isEmpty

        public abstract boolean isEmpty(T value)
        Description copied from class: JsonSerializer
        Method called to check whether given serializable value is considered "empty" value (for purposes of suppressing serialization of empty values).

        Default implementation will consider only null values to be empty.

        Overrides:
        isEmpty in class JsonSerializer<T>
      • hasSingleElement

        public abstract boolean hasSingleElement(T value)
        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).

      • _withValueTypeSerializer

        protected abstract ContainerSerializer<?> _withValueTypeSerializer(TypeSerializer vts)
        Method that needs to be implemented to allow construction of a new serializer object with given TypeSerializer, used when addition type information is to be embedded.
      • hasContentTypeAnnotation

        protected boolean hasContentTypeAnnotation(SerializerProvider provider,
                                       BeanProperty property)
        Helper 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

Copyright © 2012-2015 FasterXML. All Rights Reserved.