Package org.mongojack.internal
Class MongoJackInstantSerializer
- java.lang.Object
-
- com.fasterxml.jackson.databind.JsonSerializer<InputType>
-
- org.mongojack.TransformingEmbeddedObjectSerializer<Instant,Date>
-
- org.mongojack.internal.MongoJackInstantSerializer
-
- All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable
public class MongoJackInstantSerializer extends TransformingEmbeddedObjectSerializer<Instant,Date>
SerialisesInstant
s as BSON dates when nanosecond precision is disabled.- Author:
- Vladimir Petrakovich
- See Also:
SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS
-
-
Field Summary
-
Fields inherited from class org.mongojack.TransformingEmbeddedObjectSerializer
writeNullAsNull
-
-
Constructor Summary
Constructors Constructor Description MongoJackInstantSerializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
serialize(Instant value, com.fasterxml.jackson.core.JsonGenerator jgen, com.fasterxml.jackson.databind.SerializerProvider provider)
protected Date
transform(Instant value)
Transform to the desired type.-
Methods inherited from class org.mongojack.TransformingEmbeddedObjectSerializer
writeEmbeddedObject
-
-
-
-
Method Detail
-
transform
protected Date transform(Instant value)
Description copied from class:TransformingEmbeddedObjectSerializer
Transform to the desired type. Careful of nulls!- Specified by:
transform
in classTransformingEmbeddedObjectSerializer<Instant,Date>
- Returns:
-
serialize
public void serialize(Instant value, com.fasterxml.jackson.core.JsonGenerator jgen, com.fasterxml.jackson.databind.SerializerProvider provider) throws IOException
- Overrides:
serialize
in classTransformingEmbeddedObjectSerializer<Instant,Date>
- Throws:
IOException
-
-