Class DateSerializer
- java.lang.Object
-
- com.fasterxml.jackson.databind.JsonSerializer<T>
-
- com.fasterxml.jackson.databind.ser.std.StdSerializer<T>
-
- com.fasterxml.jackson.databind.ser.std.StdScalarSerializer<T>
-
- com.fasterxml.jackson.databind.ser.std.DateTimeSerializerBase<java.util.Date>
-
- com.fasterxml.jackson.databind.ser.std.DateSerializer
-
- All Implemented Interfaces:
JsonFormatVisitable
,SchemaAware
,ContextualSerializer
,java.io.Serializable
public class DateSerializer extends DateTimeSerializerBase<java.util.Date>
For efficiency, we will serialize Dates as longs, instead of potentially more readable Strings.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer
JsonSerializer.None
-
-
Field Summary
Fields Modifier and Type Field Description static DateSerializer
instance
Default instance that is used when no contextual configuration is needed.
-
Constructor Summary
Constructors Constructor Description DateSerializer()
DateSerializer(java.lang.Boolean useTimestamp, java.text.DateFormat customFormat)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
serialize(java.util.Date value, JsonGenerator g, SerializerProvider provider)
Method that can be called to ask implementation to serialize values of type this serializer handles.DateSerializer
withFormat(java.lang.Boolean timestamp, java.text.DateFormat customFormat)
-
Methods inherited from class com.fasterxml.jackson.databind.ser.std.DateTimeSerializerBase
acceptJsonFormatVisitor, createContextual, getSchema, isEmpty
-
Methods inherited from class com.fasterxml.jackson.databind.ser.std.StdScalarSerializer
serializeWithType
-
Methods inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer
getSchema, handledType, wrapAndThrow, wrapAndThrow
-
Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer
getDelegatee, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, unwrappingSerializer, usesObjectId, withFilterId
-
-
-
-
Field Detail
-
instance
public static final DateSerializer instance
Default instance that is used when no contextual configuration is needed.
-
-
Method Detail
-
withFormat
public DateSerializer withFormat(java.lang.Boolean timestamp, java.text.DateFormat customFormat)
- Specified by:
withFormat
in classDateTimeSerializerBase<java.util.Date>
-
serialize
public void serialize(java.util.Date value, JsonGenerator g, SerializerProvider provider) throws java.io.IOException
Description copied from class:JsonSerializer
Method that can be called to ask implementation to serialize values of type this serializer handles.- Specified by:
serialize
in classDateTimeSerializerBase<java.util.Date>
- Parameters:
value
- Value to serialize; can not be null.g
- 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.IOException
-
-