java.lang.Enum types.
Based on StdScalarSerializer since the JSON value is
scalar (String).
| Modifier and Type | Field and Description |
|---|---|
| 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). |
| 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. |
| protected final EnumValues | _valuesByEnumNaming
Map with key as converted property class defined implementation of |
| protected final EnumValues | _valuesByToString
Map that contains pre-resolved values for |
| Access | Constructor and Description |
|---|---|
| public | EnumSerializer(EnumValues v, Boolean serializeAsIndex, EnumValues valuesByEnumNaming, EnumValues valuesByToString)
|
| Modifier and Type | Method and Description |
|---|---|
| protected static Boolean | _isShapeWrittenUsingIndex(Class<?> enumClass, JsonFormat.
Helper method called to check whether serialization should be done using index (number) or not. |
| protected final boolean | |
| public void | acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
Overrides tools. Implements tools. Default implementation specifies no format. |
| public static EnumSerializer | construct(Class<?> enumClass, SerializationConfig config, BeanDescription beanDesc, JsonFormat.
Factory method used by |
| protected static EnumValues | constructEnumNamingStrategyValues(SerializationConfig config, Class<Enum<?>> enumClass, AnnotatedClass annotatedClass)
Factory method used to resolve an instance of |
| public ValueSerializer | createContextual(SerializationContext ctxt, BeanProperty property)
Overrides tools. To support some level of per-property configuration, we will need to make things contextual. |
| public EnumValues | |
| public final void | serialize(Enum<?> en, JsonGenerator g, SerializationContext ctxt)
Implements abstract tools. Method that can be called to ask implementation to serialize values of type this serializer handles. |
| _serializeAsIndex | back to summary |
|---|---|
| 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). | |
| _values | back to summary |
|---|---|
| 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. | |
| _valuesByEnumNaming | back to summary |
|---|---|
| protected final EnumValues _valuesByEnumNaming Map with key as converted property class defined implementation of | |
| _valuesByToString | back to summary |
|---|---|
| protected final EnumValues _valuesByToString Map that contains pre-resolved values for | |
| EnumSerializer | back to summary |
|---|---|
| public EnumSerializer(EnumValues v, Boolean serializeAsIndex, EnumValues valuesByEnumNaming, EnumValues valuesByToString) | |
| _isShapeWrittenUsingIndex | back to summary |
|---|---|
| protected static Boolean _isShapeWrittenUsingIndex(Class<?> enumClass, JsonFormat. Helper method called to check whether serialization should be done using index (number) or not. | |
| _serializeAsIndex | back to summary |
|---|---|
| protected final boolean _serializeAsIndex(SerializationContext ctxt) | |
| acceptJsonFormatVisitor | back to summary |
|---|---|
| public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) Overrides tools. Implements tools. Doc from tools. Default implementation specifies no format. This behavior is usually overriden by custom serializers.
| |
| construct | back to summary |
|---|---|
| public static EnumSerializer construct(Class<?> enumClass, SerializationConfig config, BeanDescription beanDesc, JsonFormat. Factory method used by
| |
| constructEnumNamingStrategyValues | back to summary |
|---|---|
| protected static EnumValues constructEnumNamingStrategyValues(SerializationConfig config, Class<Enum<?>> enumClass, AnnotatedClass annotatedClass) Factory method used to resolve an instance of | |
| createContextual | back to summary |
|---|---|
| public ValueSerializer Overrides tools. To support some level of per-property configuration, we will need to make things contextual. We are limited to "textual vs index" choice here, however.
| |
| getEnumValues | back to summary |
|---|---|
| public EnumValues getEnumValues() | |
| serialize | back to summary |
|---|---|
| public final void serialize(Enum<?> en, JsonGenerator g, SerializationContext ctxt) throws JacksonException Implements abstract tools. Doc from tools. Method that can be called to ask implementation to serialize values of type this serializer handles.
| |