Package org.codehaus.jackson.map.ser.std
Class EnumSerializer
- java.lang.Object
-
- org.codehaus.jackson.map.JsonSerializer<T>
-
- org.codehaus.jackson.map.ser.std.SerializerBase<T>
-
- org.codehaus.jackson.map.ser.std.ScalarSerializerBase<java.lang.Enum<?>>
-
- org.codehaus.jackson.map.ser.std.EnumSerializer
-
- All Implemented Interfaces:
SchemaAware
- Direct Known Subclasses:
EnumSerializer
public class EnumSerializer extends ScalarSerializerBase<java.lang.Enum<?>>
Standard serializer used forEnumtypes.Based on
ScalarSerializerBasesince the JSON value is scalar (String).- Author:
- tatu
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.codehaus.jackson.map.JsonSerializer
JsonSerializer.None
-
-
Field Summary
Fields Modifier and Type Field Description protected EnumValues_valuesThis map contains pre-resolved values (since there are ways to customize actual String constants to use) to use as serializations.-
Fields inherited from class org.codehaus.jackson.map.ser.std.SerializerBase
_handledType
-
-
Constructor Summary
Constructors Constructor Description EnumSerializer(EnumValues v)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EnumSerializerconstruct(java.lang.Class<java.lang.Enum<?>> enumClass, SerializationConfig config, BasicBeanDescription beanDesc)EnumValuesgetEnumValues()JsonNodegetSchema(SerializerProvider provider, java.lang.reflect.Type typeHint)Note: since Jackson 1.9, default implementation claims type is "string"voidserialize(java.lang.Enum<?> en, JsonGenerator jgen, SerializerProvider provider)Method that can be called to ask implementation to serialize values of type this serializer handles.-
Methods inherited from class org.codehaus.jackson.map.ser.std.ScalarSerializerBase
serializeWithType
-
Methods inherited from class org.codehaus.jackson.map.ser.std.SerializerBase
createObjectNode, createSchemaNode, createSchemaNode, handledType, isDefaultSerializer, wrapAndThrow, wrapAndThrow, wrapAndThrow, wrapAndThrow
-
Methods inherited from class org.codehaus.jackson.map.JsonSerializer
isUnwrappingSerializer, unwrappingSerializer
-
-
-
-
Field Detail
-
_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.
-
-
Constructor Detail
-
EnumSerializer
public EnumSerializer(EnumValues v)
-
-
Method Detail
-
construct
public static EnumSerializer construct(java.lang.Class<java.lang.Enum<?>> enumClass, SerializationConfig config, BasicBeanDescription beanDesc)
-
serialize
public final void serialize(java.lang.Enum<?> en, JsonGenerator jgen, SerializerProvider provider) throws java.io.IOException, JsonGenerationExceptionDescription copied from class:JsonSerializerMethod that can be called to ask implementation to serialize values of type this serializer handles.- Specified by:
serializein classSerializerBase<java.lang.Enum<?>>- Parameters:
en- Value to serialize; can not be null.jgen- Generator used to output resulting Json contentprovider- Provider that can be used to get serializers for serializing Objects value contains, if any.- Throws:
java.io.IOExceptionJsonGenerationException
-
getSchema
public JsonNode getSchema(SerializerProvider provider, java.lang.reflect.Type typeHint)
Description copied from class:SerializerBaseNote: since Jackson 1.9, default implementation claims type is "string"- Specified by:
getSchemain interfaceSchemaAware- Overrides:
getSchemain classScalarSerializerBase<java.lang.Enum<?>>- Parameters:
provider- The serializer provider.typeHint- A hint about the type.- Returns:
- Json-schema for this serializer.
-
getEnumValues
public EnumValues getEnumValues()
-
-