Class EnumSerializer

All Implemented Interfaces:
JsonFormatVisitable

public class EnumSerializer extends StdScalarSerializer<Enum<?>>
Standard serializer used for Enum types.

Based on StdScalarSerializer since the JSON value is scalar (String).

  • Field Details

    • _values

      protected final EnumValues _values
      This map contains pre-resolved values (since there are ways to customize actual String constants to use) to use as serializations.
    • _serializeAsIndex

      protected final Boolean _serializeAsIndex
      Flag that is set if we statically know serialization choice between index and textual format (null if it needs to be dynamically checked).
    • _valuesByEnumNaming

      protected final EnumValues _valuesByEnumNaming
      Map with key as converted property class defined implementation of EnumNamingStrategy and with value as Enum names collected using Enum.name().
    • _valuesByToString

      protected final EnumValues _valuesByToString
      Map that contains pre-resolved values for Enum.toString() to use for serialization, while respecting JsonProperty and EnumFeature.WRITE_ENUMS_TO_LOWERCASE.
  • Constructor Details

  • Method Details