Class InstantSerializer
java.lang.Object
org.eclipse.yasson.internal.serializer.types.TypeSerializer<Instant>
org.eclipse.yasson.internal.serializer.types.AbstractDateSerializer<Instant>
org.eclipse.yasson.internal.serializer.types.InstantSerializer
- All Implemented Interfaces:
ModelSerializer
Serializer of the
Instant type.-
Field Summary
Fields inherited from class AbstractDateSerializer
UTC -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringformatDefault(Instant value, Locale locale) Format with default formatter for a given java.time date object.protected StringformatStrictIJson(Instant value) Format date object as strict IJson date format.protected StringformatWithFormatter(Instant value, DateTimeFormatter formatter) Format date object with given formatter.protected InstantConvert java.time object to epoch milliseconds instant.Methods inherited from class AbstractDateSerializer
getZonedFormatter, serializeKey, serializeValue, toTemporalAccessorMethods inherited from class TypeSerializer
serialize
-
Constructor Details
-
InstantSerializer
InstantSerializer(TypeSerializerBuilder serializerBuilder)
-
-
Method Details
-
toInstant
Description copied from class:AbstractDateSerializerConvert java.time object to epoch milliseconds instant. Discards zone offset and zone id information.- Specified by:
toInstantin classAbstractDateSerializer<Instant>- Parameters:
value- date object to convert- Returns:
- instant
-
formatDefault
Description copied from class:AbstractDateSerializerFormat with default formatter for a given java.time date object. Different default formatter for each date object type is used.- Specified by:
formatDefaultin classAbstractDateSerializer<Instant>- Parameters:
value- date objectlocale- locale from annotation / default not null- Returns:
- formatted date obj as string
-
formatWithFormatter
Description copied from class:AbstractDateSerializerFormat date object with given formatter.- Overrides:
formatWithFormatterin classAbstractDateSerializer<Instant>- Parameters:
value- date object to formatformatter- formatter to format with- Returns:
- formatted result
-
formatStrictIJson
Description copied from class:AbstractDateSerializerFormat date object as strict IJson date format.- Overrides:
formatStrictIJsonin classAbstractDateSerializer<Instant>- Parameters:
value- value to format- Returns:
- formatted result
-