Class InstantTypeSerializer
java.lang.Object
org.eclipse.yasson.internal.serializer.AbstractValueTypeSerializer<T>
org.eclipse.yasson.internal.serializer.AbstractDateTimeSerializer<Instant>
org.eclipse.yasson.internal.serializer.InstantTypeSerializer
- All Implemented Interfaces:
javax.json.bind.serializer.JsonbSerializer<Instant>
Serializer for
Instant
type.-
Field Summary
Fields inherited from class org.eclipse.yasson.internal.serializer.AbstractDateTimeSerializer
UTC
-
Constructor Summary
-
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.AbstractDateTimeSerializer
getJsonbDateFormatter, getZonedFormatter, serialize, serialize, toJson, toTemporalAccessor
Methods inherited from class org.eclipse.yasson.internal.serializer.AbstractValueTypeSerializer
getCustomization
-
Constructor Details
-
InstantTypeSerializer
Creates a new instance.- Parameters:
customization
- Model customization.
-
-
Method Details
-
toInstant
Description copied from class:AbstractDateTimeSerializer
Convert java.time object to epoch milliseconds instant. Discards zone offset and zone id information.- Specified by:
toInstant
in classAbstractDateTimeSerializer<Instant>
- Parameters:
value
- date object to convert- Returns:
- instant
-
formatDefault
Description copied from class:AbstractDateTimeSerializer
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 classAbstractDateTimeSerializer<Instant>
- Parameters:
value
- date objectlocale
- locale from annotation / default not null- Returns:
- formatted date obj as string
-
formatWithFormatter
Description copied from class:AbstractDateTimeSerializer
Format date object with given formatter.- Overrides:
formatWithFormatter
in classAbstractDateTimeSerializer<Instant>
- Parameters:
value
- date object to formatformatter
- formatter to format with- Returns:
- formatted result
-
formatStrictIJson
Description copied from class:AbstractDateTimeSerializer
Format date object as strict IJson date format.- Overrides:
formatStrictIJson
in classAbstractDateTimeSerializer<Instant>
- Parameters:
value
- value to format- Returns:
- formatted result
-