Class JacksonSerializers.EnumTranslatingSerializer
java.lang.Object
com.fasterxml.jackson.databind.JsonSerializer<T>
com.fasterxml.jackson.databind.ser.std.StdSerializer<Enum>
org.springframework.data.rest.webmvc.json.JacksonSerializers.EnumTranslatingSerializer
- All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable
,com.fasterxml.jackson.databind.jsonschema.SchemaAware
,Serializable
,JsonSchemaPropertyCustomizer
- Enclosing class:
- JacksonSerializers
public static class JacksonSerializers.EnumTranslatingSerializer
extends com.fasterxml.jackson.databind.ser.std.StdSerializer<Enum>
implements JsonSchemaPropertyCustomizer
An enum serializer to translate raw enum values into values resolved through a resource bundle.
- Author:
- Oliver Gierke
- See Also:
-
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.StdSerializer
_handledType
-
Constructor Summary
ConstructorDescriptionEnumTranslatingSerializer
(EnumTranslator translator) Creates a newJacksonSerializers.EnumTranslatingSerializer
using the givenEnumTranslator
. -
Method Summary
Modifier and TypeMethodDescriptioncustomize
(JsonSchema.JsonSchemaProperty property, org.springframework.data.util.TypeInformation<?> type) Returns the customizedJsonSchema.JsonSchemaProperty
based on the given one and the given type.void
serialize
(Enum value, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider provider) Methods inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer
_neitherNull, _nonEmpty, acceptJsonFormatVisitor, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findContextualConvertingSerializer, findConvertingContentSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, getSchema, 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, serializeWithType, unwrappingSerializer, usesObjectId, withFilterId
-
Constructor Details
-
EnumTranslatingSerializer
Creates a newJacksonSerializers.EnumTranslatingSerializer
using the givenEnumTranslator
.- Parameters:
translator
- must not be null.
-
-
Method Details
-
serialize
public void serialize(Enum value, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider provider) throws IOException - Specified by:
serialize
in classcom.fasterxml.jackson.databind.ser.std.StdSerializer<Enum>
- Throws:
IOException
-
customize
public JsonSchema.JsonSchemaProperty customize(JsonSchema.JsonSchemaProperty property, org.springframework.data.util.TypeInformation<?> type) Description copied from interface:JsonSchemaPropertyCustomizer
Returns the customizedJsonSchema.JsonSchemaProperty
based on the given one and the given type.- Specified by:
customize
in interfaceJsonSchemaPropertyCustomizer
- Parameters:
property
- will never be null.type
- will never be null.- Returns:
-