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:
  JsonFormatVisitable, SchemaAware, ContextualSerializer, Serializable

    public class DateSerializer
    extends DateTimeSerializerBase<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
`static DateSerializer` `instance` Default instance that is used when no contextual configuration is needed.

### Fields inherited from class com.fasterxml.jackson.databind.ser.std.DateTimeSerializerBase

`_customFormat, _useTimestamp`

### Fields inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer

`_handledType`

### Constructor Summary

Constructors
Constructor and Description
`DateSerializer()`
`DateSerializer(Boolean useTimestamp, DateFormat customFormat)`

### Method Summary

Methods
`protected long` `_timestamp(Date value)`
`void` `serialize(Date value, JsonGenerator gen, SerializerProvider provider)` Method that can be called to ask implementation to serialize values of type this serializer handles.
`DateSerializer` `withFormat(Boolean timestamp, DateFormat customFormat)`

### Methods inherited from class com.fasterxml.jackson.databind.ser.std.DateTimeSerializerBase

`_acceptJsonFormatVisitor, _asTimestamp, acceptJsonFormatVisitor, createContextual, getSchema, isEmpty, isEmpty`

### Methods inherited from class com.fasterxml.jackson.databind.ser.std.StdScalarSerializer

`serializeWithType`

### Methods inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer

`createObjectNode, createSchemaNode, createSchemaNode, findConvertingContentSerializer, findFormatFeature, findFormatOverrides, findPropertyFilter, getSchema, handledType, isDefaultSerializer, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrow`

### Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer

`getDelegatee, isUnwrappingSerializer, properties, replaceDelegatee, unwrappingSerializer, usesObjectId, withFilterId`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### instance

    public static final DateSerializer instance

Default instance that is used when no contextual configuration is needed.

### Constructor Detail

#### DateSerializer

    public DateSerializer()

#### DateSerializer

    public DateSerializer(Boolean useTimestamp,
                  DateFormat customFormat)

### Method Detail

#### 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,
                 JsonGenerator gen,
                 SerializerProvider provider)
                   throws 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 class `DateTimeSerializerBase<Date>`
Parameters:
  `value` - Value to serialize; can not be null.
  `gen` - Generator used to output resulting Json content
  `provider` - Provider that can be used to get serializers for serializing Objects value contains, if any.
Throws:
  `IOException`