Class ZonedDateTimeConverter
java.lang.Object
overit.geocallapp.utilities.rs.converter.ZonedDateTimeConverter
- Direct Known Subclasses:
FromDateToZonedDateTimeConverter,FromZonedDateTimeRangeToDateTimeRangeConverter,FromZonedDateTimeToDateConverter
Abstract base class for
This class provides shared utilities for extracting
ZonedDateTime converters providing common timezone resolution functionality.This class provides shared utilities for extracting
DateType annotations from object properties and resolving time zones.- Since:
- 1.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a newZonedDateTimeConverterwith default timezone handling.protectedZonedDateTimeConverter(TimeZone timeZone) Creates a newZonedDateTimeConverterwith a specific timezone. -
Method Summary
Modifier and TypeMethodDescriptionprotected DateTypegetDateTypeByDestination(MappingContext<?, ?> context, MappingContext<?, ?> initialContext) Extracts theDateTypeannotation value from the destination property.protected DateTypegetDateTypeBySource(MappingContext<?, ?> context, MappingContext<?, ?> initialContext) Extracts theDateTypeannotation value from the source property.getTimeZone(Class<?> cls, Object firstItem, Object secondItem) Gets the time zone to use for conversions, resolving it if not already set.
-
Field Details
-
LOG
-
-
Constructor Details
-
ZonedDateTimeConverter
protected ZonedDateTimeConverter()Creates a newZonedDateTimeConverterwith default timezone handling. -
ZonedDateTimeConverter
Creates a newZonedDateTimeConverterwith a specific timezone.- Parameters:
timeZone- theTimeZoneto use for conversions
-
-
Method Details
-
getTimeZone
Gets the time zone to use for conversions, resolving it if not already set.- Parameters:
cls- the class to use for timezone resolutionfirstItem- the first object for timezone resolutionsecondItem- the second object for timezone resolution- Returns:
- the resolved
TimeZone
-
getDateTypeBySource
protected DateType getDateTypeBySource(MappingContext<?, ?> context, MappingContext<?, ?> initialContext) Extracts theDateTypeannotation value from the source property. Uses the source object's class to locate the property and itsDateTypeannotation.- Parameters:
context- the current mapping contextinitialContext- the main mapping context containing the source object- Returns:
- the
DateTypeannotation of the source property, or null if not found
-
getDateTypeByDestination
protected DateType getDateTypeByDestination(MappingContext<?, ?> context, MappingContext<?, ?> initialContext) Extracts theDateTypeannotation value from the destination property. Uses the destination object's class to locate the property and itsDateTypeannotation.- Parameters:
context- the current mapping contextinitialContext- the main mapping context containing the destination object- Returns:
- the
DateTypeannotation of the destination property, or null if not found
-