Class AbstractDateTimeDeserializer<T>
- java.lang.Object
-
- org.eclipse.yasson.internal.serializer.AbstractValueTypeDeserializer<T>
-
- org.eclipse.yasson.internal.serializer.AbstractDateTimeDeserializer<T>
-
- Type Parameters:
T
- date type
- All Implemented Interfaces:
javax.json.bind.serializer.JsonbDeserializer<T>
- Direct Known Subclasses:
CalendarTypeDeserializer
,DateTypeDeserializer
,InstantTypeDeserializer
,LocalDateTimeTypeDeserializer
,LocalDateTypeDeserializer
,LocalTimeTypeDeserializer
,OffsetDateTimeTypeDeserializer
,OffsetTimeTypeDeserializer
,SqlDateTypeDeserializer
,SqlTimestampTypeDeserializer
,XMLGregorianCalendarTypeDeserializer
,ZonedDateTimeTypeDeserializer
public abstract class AbstractDateTimeDeserializer<T> extends AbstractValueTypeDeserializer<T>
Abstract class for converting date objects from java.time.
-
-
Field Summary
Fields Modifier and Type Field Description static java.time.ZoneId
UTC
Default zone id.
-
Constructor Summary
Constructors Constructor Description AbstractDateTimeDeserializer(java.lang.Class<T> clazz, Customization customization)
Creates an instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description T
deserialize(java.lang.String jsonValue, Unmarshaller unmarshaller, java.lang.reflect.Type rtType)
Convert string value to object.protected abstract T
fromInstant(java.time.Instant instant)
Construct date object from an instant containing epoch millisecond.protected JsonbDateFormatter
getJsonbDateFormatter(JsonbContext context)
Returns registered deserialization jsonb date formatter.protected java.time.format.DateTimeFormatter
getZonedFormatter(java.time.format.DateTimeFormatter formatter)
Append UTC zone in case zone is not set on formatter.protected abstract T
parseDefault(java.lang.String jsonValue, java.util.Locale locale)
Parse java.time date object with default formatter.protected abstract T
parseWithFormatter(java.lang.String jsonValue, java.time.format.DateTimeFormatter formatter)
Parse java.time date object with provided formatter.-
Methods inherited from class org.eclipse.yasson.internal.serializer.AbstractValueTypeDeserializer
deserialize, getCustomization, getPropertyType
-
-
-
-
Constructor Detail
-
AbstractDateTimeDeserializer
public AbstractDateTimeDeserializer(java.lang.Class<T> clazz, Customization customization)
Creates an instance.- Parameters:
clazz
- Class to create deserializer for.customization
- Model customization.
-
-
Method Detail
-
deserialize
public T deserialize(java.lang.String jsonValue, Unmarshaller unmarshaller, java.lang.reflect.Type rtType)
Description copied from class:AbstractValueTypeDeserializer
Convert string value to object.- Overrides:
deserialize
in classAbstractValueTypeDeserializer<T>
- Parameters:
jsonValue
- Json value.unmarshaller
- Unmarshaller instance.rtType
- Runtime type.- Returns:
- Deserialized object.
-
getJsonbDateFormatter
protected JsonbDateFormatter getJsonbDateFormatter(JsonbContext context)
Returns registered deserialization jsonb date formatter.- Parameters:
context
- context- Returns:
- date formatter
-
getZonedFormatter
protected java.time.format.DateTimeFormatter getZonedFormatter(java.time.format.DateTimeFormatter formatter)
Append UTC zone in case zone is not set on formatter.- Parameters:
formatter
- formatter- Returns:
- zoned formatter
-
fromInstant
protected abstract T fromInstant(java.time.Instant instant)
Construct date object from an instant containing epoch millisecond. If date object supports zone offset / zone id, system default is used and warning is logged.- Parameters:
instant
- instant to construct from- Returns:
- date object
-
parseDefault
protected abstract T parseDefault(java.lang.String jsonValue, java.util.Locale locale)
Parse java.time date object with default formatter. Different default formatter for each date object type is used.- Parameters:
jsonValue
- string value to parse fromlocale
- annotated locale or default- Returns:
- parsed date object
-
parseWithFormatter
protected abstract T parseWithFormatter(java.lang.String jsonValue, java.time.format.DateTimeFormatter formatter)
Parse java.time date object with provided formatter.- Parameters:
jsonValue
- string value to parse fromformatter
- a formatter to use- Returns:
- parsed date object
-
-