Module org.eclipse.yasson
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 org.eclipse.yasson.internal.serializer.types.AbstractDateSerializer
UTC
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
formatDefault
(Instant value, Locale locale) Format with default formatter for a given java.time date object.protected String
formatStrictIJson
(Instant value) Format date object as strict IJson date format.protected String
formatWithFormatter
(Instant value, DateTimeFormatter formatter) Format date object with given formatter.protected Instant
Convert java.time object to epoch milliseconds instant.Methods inherited from class org.eclipse.yasson.internal.serializer.types.AbstractDateSerializer
getZonedFormatter, serializeKey, serializeValue, toTemporalAccessor
Methods inherited from class org.eclipse.yasson.internal.serializer.types.TypeSerializer
serialize
-
Constructor Details
-
InstantSerializer
InstantSerializer(TypeSerializerBuilder serializerBuilder)
-
-
Method Details
-
toInstant
Description copied from class:AbstractDateSerializer
Convert java.time object to epoch milliseconds instant. Discards zone offset and zone id information.- Specified by:
toInstant
in classAbstractDateSerializer<Instant>
- Parameters:
value
- date object to convert- Returns:
- instant
-
formatDefault
Description copied from class:AbstractDateSerializer
Format with default formatter for a given java.time date object. Different default formatter for each date object type is used.- Specified by:
formatDefault
in classAbstractDateSerializer<Instant>
- Parameters:
value
- date objectlocale
- locale from annotation / default not null- Returns:
- formatted date obj as string
-
formatWithFormatter
Description copied from class:AbstractDateSerializer
Format date object with given formatter.- Overrides:
formatWithFormatter
in classAbstractDateSerializer<Instant>
- Parameters:
value
- date object to formatformatter
- formatter to format with- Returns:
- formatted result
-
formatStrictIJson
Description copied from class:AbstractDateSerializer
Format date object as strict IJson date format.- Overrides:
formatStrictIJson
in classAbstractDateSerializer<Instant>
- Parameters:
value
- value to format- Returns:
- formatted result
-