Class ThreeTenModule
- java.lang.Object
-
- com.fasterxml.jackson.databind.Module
-
- com.fasterxml.jackson.databind.module.SimpleModule
-
- com.azure.android.core.serde.jackson.implementation.threeten.ThreeTenModule
-
- All Implemented Interfaces:
com.fasterxml.jackson.core.Versioned
,java.io.Serializable
public final class ThreeTenModule extends com.fasterxml.jackson.databind.module.SimpleModule
Class that registers capability of serializingorg.threeten.bp
objects with the Jackson core.ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JavaTimeModule());
Mostorg.threeten.bp
types are serialized as numbers (integers or decimals as appropriate) if theSerializationFeature.WRITE_DATES_AS_TIMESTAMPS
feature is enabled (or, forDuration
,SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS
), and otherwise are serialized in standard ISO-8601 string representation. ISO-8601 specifies formats for representing offset dates and times, zoned dates and times, local dates and times, periods, durations, zones, and more. Allorg.threeten.bp
types have built-in translation to and from ISO-8601 formats.Granularity of timestamps is controlled through the companion features
SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS
andDeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS
. For serialization, timestamps are written as fractional numbers (decimals), where the number is seconds and the decimal is fractional seconds, ifWRITE_DATE_TIMESTAMPS_AS_NANOSECONDS
is enabled (it is by default), with resolution as fine as nanoseconds depending on the underlying JDK implementation. IfWRITE_DATE_TIMESTAMPS_AS_NANOSECONDS
is disabled, timestamps are written as a whole number of milliseconds. At deserialization time, decimal numbers are always read as fractional second timestamps with up-to-nanosecond resolution, since the meaning of the decimal is unambiguous. The more ambiguous integer types are read as fractional seconds without a decimal point ifREAD_DATE_TIMESTAMPS_AS_NANOSECONDS
is enabled (it is by default), and otherwise they are read as milliseconds.- Since:
- 2.6
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ThreeTenModule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.fasterxml.jackson.databind.introspect.AnnotatedMethod
_findFactory(com.fasterxml.jackson.databind.introspect.AnnotatedClass cls, java.lang.String name, java.lang.Class<?>... argTypes)
void
setupModule(com.fasterxml.jackson.databind.Module.SetupContext context)
-
Methods inherited from class com.fasterxml.jackson.databind.module.SimpleModule
_checkNotNull, addAbstractTypeMapping, addDeserializer, addKeyDeserializer, addKeySerializer, addSerializer, addSerializer, addValueInstantiator, getModuleName, getTypeId, registerSubtypes, registerSubtypes, registerSubtypes, setAbstractTypes, setDeserializerModifier, setDeserializers, setKeyDeserializers, setKeySerializers, setMixInAnnotation, setNamingStrategy, setSerializerModifier, setSerializers, setValueInstantiators, version
-
-
-
-
Method Detail
-
setupModule
public void setupModule(com.fasterxml.jackson.databind.Module.SetupContext context)
- Overrides:
setupModule
in classcom.fasterxml.jackson.databind.module.SimpleModule
-
_findFactory
protected com.fasterxml.jackson.databind.introspect.AnnotatedMethod _findFactory(com.fasterxml.jackson.databind.introspect.AnnotatedClass cls, java.lang.String name, java.lang.Class<?>... argTypes)
-
-