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.
-
-
Constructor Summary
Constructors Constructor Description AbstractDateTimeDeserializer(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(String jsonValue, Unmarshaller unmarshaller, Type rtType)
Convert string value to object.protected abstract T
fromInstant(Instant instant)
Construct date object from an instant containing epoch millisecond.protected JsonbDateFormatter
getJsonbDateFormatter(JsonbContext context)
Returns registered deserialization jsonb date formatter.protected DateTimeFormatter
getZonedFormatter(DateTimeFormatter formatter)
Append UTC zone in case zone is not set on formatter.protected abstract T
parseDefault(String jsonValue, Locale locale)
Parse java.time date object with default formatter.protected abstract T
parseWithFormatter(String jsonValue, DateTimeFormatter formatter)
Parse java.time date object with provided formatter.-
Methods inherited from class org.eclipse.yasson.internal.serializer.AbstractValueTypeDeserializer
deserialize, getCustomization, getPropertyType
-
-
-
-
Field Detail
-
UTC
public static final ZoneId UTC
Default zone id.
-
-
Constructor Detail
-
AbstractDateTimeDeserializer
public AbstractDateTimeDeserializer(Class<T> clazz, Customization customization)
Creates an instance.- Parameters:
clazz
- Class to create deserializer for.customization
- Model customization.
-
-
Method Detail
-
deserialize
public T deserialize(String jsonValue, Unmarshaller unmarshaller, 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 DateTimeFormatter getZonedFormatter(DateTimeFormatter formatter)
Append UTC zone in case zone is not set on formatter.- Parameters:
formatter
- formatter- Returns:
- zoned formatter
-
fromInstant
protected abstract T fromInstant(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(String jsonValue, 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(String jsonValue, 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
-
-