Class InstantTypeSerializer
- java.lang.Object
-
- org.eclipse.yasson.internal.serializer.AbstractValueTypeSerializer<T>
-
- org.eclipse.yasson.internal.serializer.AbstractDateTimeSerializer<java.time.Instant>
-
- org.eclipse.yasson.internal.serializer.InstantTypeSerializer
-
- All Implemented Interfaces:
javax.json.bind.serializer.JsonbSerializer<java.time.Instant>
public class InstantTypeSerializer extends AbstractDateTimeSerializer<java.time.Instant>
Serializer forInstant
type.
-
-
Field Summary
-
Fields inherited from class org.eclipse.yasson.internal.serializer.AbstractDateTimeSerializer
UTC
-
-
Constructor Summary
Constructors Constructor Description InstantTypeSerializer(Customization customization)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
formatDefault(java.time.Instant value, java.util.Locale locale)
Format with default formatter for a given java.time date object.protected java.lang.String
formatStrictIJson(java.time.Instant value)
Format date object as strict IJson date format.protected java.lang.String
formatWithFormatter(java.time.Instant value, java.time.format.DateTimeFormatter formatter)
Format date object with given formatter.protected java.time.Instant
toInstant(java.time.Instant value)
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 Detail
-
InstantTypeSerializer
public InstantTypeSerializer(Customization customization)
Creates a new instance.- Parameters:
customization
- Model customization.
-
-
Method Detail
-
toInstant
protected java.time.Instant toInstant(java.time.Instant value)
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<java.time.Instant>
- Parameters:
value
- date object to convert- Returns:
- instant
-
formatDefault
protected java.lang.String formatDefault(java.time.Instant value, java.util.Locale locale)
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<java.time.Instant>
- Parameters:
value
- date objectlocale
- locale from annotation / default not null- Returns:
- formatted date obj as string
-
formatWithFormatter
protected java.lang.String formatWithFormatter(java.time.Instant value, java.time.format.DateTimeFormatter formatter)
Description copied from class:AbstractDateTimeSerializer
Format date object with given formatter.- Overrides:
formatWithFormatter
in classAbstractDateTimeSerializer<java.time.Instant>
- Parameters:
value
- date object to formatformatter
- formatter to format with- Returns:
- formatted result
-
formatStrictIJson
protected java.lang.String formatStrictIJson(java.time.Instant value)
Description copied from class:AbstractDateTimeSerializer
Format date object as strict IJson date format.- Overrides:
formatStrictIJson
in classAbstractDateTimeSerializer<java.time.Instant>
- Parameters:
value
- value to format- Returns:
- formatted result
-
-