public class EnumSerializer extends StdScalarSerializer<Enum<?>> implements ContextualSerializer
Enum types.
 Based on StdScalarSerializer since the JSON value is
 scalar (String).
JsonSerializer.None| Modifier and Type | Field and Description | 
|---|---|
| protected Boolean | _serializeAsIndexFlag that is set if we statically know serialization choice
 between index and textual format (null if it needs to be dynamically
 checked). | 
| protected EnumValues | _valuesThis map contains pre-resolved values (since there are ways
 to customize actual String constants to use) to use as
 serializations. | 
_handledType| Constructor and Description | 
|---|
| EnumSerializer(EnumValues v)Deprecated. 
 Since 2.1 | 
| EnumSerializer(EnumValues v,
              Boolean serializeAsIndex) | 
| Modifier and Type | Method and Description | 
|---|---|
| protected static Boolean | _isShapeWrittenUsingIndex(Class<?> enumClass,
                         JsonFormat.Value format,
                         boolean fromClass)Helper method called to check whether | 
| protected boolean | _serializeAsIndex(SerializerProvider serializers) | 
| void | acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor,
                       JavaType typeHint)Default implementation specifies no format. | 
| static EnumSerializer | construct(Class<?> enumClass,
         SerializationConfig config,
         BeanDescription beanDesc,
         JsonFormat.Value format)Factory method used by  BasicSerializerFactoryfor constructing serializer instance of Enum types. | 
| JsonSerializer<?> | createContextual(SerializerProvider serializers,
                BeanProperty property)To support some level of per-property configuration, we will need
 to make things contextual. | 
| EnumValues | getEnumValues() | 
| JsonNode | getSchema(SerializerProvider provider,
         Type typeHint)Default implementation simply claims type is "string"; usually
 overriden by custom serializers. | 
| void | serialize(Enum<?> en,
         JsonGenerator gen,
         SerializerProvider serializers)Method that can be called to ask implementation to serialize
 values of type this serializer handles. | 
serializeWithTypecreateObjectNode, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findConvertingContentSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, getSchema, handledType, isDefaultSerializer, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrowgetDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, unwrappingSerializer, usesObjectId, withFilterIdprotected final EnumValues _values
protected final Boolean _serializeAsIndex
@Deprecated public EnumSerializer(EnumValues v)
public EnumSerializer(EnumValues v, Boolean serializeAsIndex)
public static EnumSerializer construct(Class<?> enumClass, SerializationConfig config, BeanDescription beanDesc, JsonFormat.Value format)
BasicSerializerFactory
 for constructing serializer instance of Enum types.public JsonSerializer<?> createContextual(SerializerProvider serializers, BeanProperty property) throws JsonMappingException
createContextual in interface ContextualSerializerserializers - Serializer provider to use for accessing config, other serializersproperty - Method or field that represents the property
   (and is used to access value to serialize).
   Should be available; but there may be cases where caller can not provide it and
   null is passed instead (in which case impls usually pass 'this' serializer as is)JsonMappingExceptionpublic EnumValues getEnumValues()
public final void serialize(Enum<?> en, JsonGenerator gen, SerializerProvider serializers) throws IOException
JsonSerializerserialize in class StdSerializer<Enum<?>>en - Value to serialize; can not be null.gen - Generator used to output resulting Json contentserializers - Provider that can be used to get serializers for
   serializing Objects value contains, if any.IOExceptionpublic JsonNode getSchema(SerializerProvider provider, Type typeHint)
StdSerializergetSchema in interface SchemaAwaregetSchema in class StdScalarSerializer<Enum<?>>provider - The serializer provider.typeHint - A hint about the type.public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException
StdSerializeracceptJsonFormatVisitor in interface JsonFormatVisitableacceptJsonFormatVisitor in class StdScalarSerializer<Enum<?>>typeHint - Type of element (entity like property) being visitedJsonMappingExceptionprotected final boolean _serializeAsIndex(SerializerProvider serializers)
protected static Boolean _isShapeWrittenUsingIndex(Class<?> enumClass, JsonFormat.Value format, boolean fromClass)
Copyright © 2017 JBoss by Red Hat. All rights reserved.