com.fasterxml.jackson.databind.ser.std
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<Date>
com.fasterxml.jackson.databind.ser.std.DateSerializer
- All Implemented Interfaces:
- SchemaAware, ContextualSerializer
public class DateSerializer
- extends DateTimeSerializerBase<Date>
For efficiency, we will serialize Dates as longs, instead of
potentially more readable Strings.
Field Summary |
static DateSerializer |
instance
Default instance that is used when no contextual configuration
is needed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
instance
public static DateSerializer instance
- Default instance that is used when no contextual configuration
is needed.
DateSerializer
public DateSerializer()
DateSerializer
public DateSerializer(boolean useTimestamp,
DateFormat customFormat)
withFormat
public DateSerializer withFormat(boolean timestamp,
DateFormat customFormat)
- Specified by:
withFormat
in class DateTimeSerializerBase<Date>
_timestamp
protected long _timestamp(Date value)
- Specified by:
_timestamp
in class DateTimeSerializerBase<Date>
serialize
public void serialize(Date value,
com.fasterxml.jackson.core.JsonGenerator jgen,
SerializerProvider provider)
throws IOException,
com.fasterxml.jackson.core.JsonGenerationException
- 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 class DateTimeSerializerBase<Date>
- Parameters:
value
- 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:
IOException
com.fasterxml.jackson.core.JsonGenerationException
Copyright © 2012 fasterxml.com. All Rights Reserved.