Class EnumSetSerializer

All Implemented Interfaces:
JsonFormatVisitable

public class EnumSetSerializer extends AsArraySerializerBase<EnumSet<? extends Enum<?>>>
  • Constructor Details

  • Method Details

    • _withValueTypeSerializer

      protected EnumSetSerializer _withValueTypeSerializer(TypeSerializer vts)
      Description copied from class: StdContainerSerializer
      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.
      Specified by:
      _withValueTypeSerializer in class StdContainerSerializer<EnumSet<? extends Enum<?>>>
    • withResolved

      public EnumSetSerializer withResolved(BeanProperty property, TypeSerializer vts, ValueSerializer<?> elementSerializer, Boolean unwrapSingle, Object suppressableValue, boolean suppressNulls)
      Description copied from class: AsArraySerializerBase
      Factory method to use for creating differently configured instances, called by this class (from #createContextual), overridden by implementation class.

      NOTE: only implemented for backwards-compatibility with 3.0 version JacksonModules, otherwise would be abstract: sub-classes really need to override.

      Overrides:
      withResolved in class AsArraySerializerBase<EnumSet<? extends Enum<?>>>
    • isEmpty

      public boolean isEmpty(SerializationContext prov, EnumSet<? extends Enum<?>> value)
      Description copied from class: ValueSerializer
      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.

      Specified by:
      isEmpty in class StdContainerSerializer<EnumSet<? extends Enum<?>>>
    • hasSingleElement

      public boolean hasSingleElement(EnumSet<? extends Enum<?>> value)
      Description copied from class: StdContainerSerializer
      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).

      Note, too, that this method is only called by serializer itself; and specifically is not used for non-array/collection types like Map or Map.Entry instances.

      Specified by:
      hasSingleElement in class StdContainerSerializer<EnumSet<? extends Enum<?>>>
    • serialize

      public final void serialize(EnumSet<? extends Enum<?>> 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<EnumSet<? extends Enum<?>>>
      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
    • serializeContents

      public void serializeContents(EnumSet<? extends Enum<?>> value, tools.jackson.core.JsonGenerator g, SerializationContext ctxt) throws tools.jackson.core.JacksonException
      Specified by:
      serializeContents in class AsArraySerializerBase<EnumSet<? extends Enum<?>>>
      Throws:
      tools.jackson.core.JacksonException