Class ZonedDateTimeConverter

java.lang.Object
overit.geocallapp.utilities.rs.converter.ZonedDateTimeConverter
Direct Known Subclasses:
FromDateToZonedDateTimeConverter, FromZonedDateTimeRangeToDateTimeRangeConverter, FromZonedDateTimeToDateConverter

public abstract class ZonedDateTimeConverter extends Object
Abstract base class for 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 Details

  • Constructor Details

    • ZonedDateTimeConverter

      protected ZonedDateTimeConverter()
      Creates a new ZonedDateTimeConverter with default timezone handling.
    • ZonedDateTimeConverter

      protected ZonedDateTimeConverter(TimeZone timeZone)
      Creates a new ZonedDateTimeConverter with a specific timezone.
      Parameters:
      timeZone - the TimeZone to use for conversions
  • Method Details

    • getTimeZone

      public TimeZone getTimeZone(Class<?> cls, Object firstItem, Object secondItem)
      Gets the time zone to use for conversions, resolving it if not already set.
      Parameters:
      cls - the class to use for timezone resolution
      firstItem - the first object for timezone resolution
      secondItem - the second object for timezone resolution
      Returns:
      the resolved TimeZone
    • getDateTypeBySource

      protected DateType getDateTypeBySource(MappingContext<?,?> context, MappingContext<?,?> initialContext)
      Extracts the DateType annotation value from the source property. Uses the source object's class to locate the property and its DateType annotation.
      Parameters:
      context - the current mapping context
      initialContext - the main mapping context containing the source object
      Returns:
      the DateType annotation of the source property, or null if not found
    • getDateTypeByDestination

      protected DateType getDateTypeByDestination(MappingContext<?,?> context, MappingContext<?,?> initialContext)
      Extracts the DateType annotation value from the destination property. Uses the destination object's class to locate the property and its DateType annotation.
      Parameters:
      context - the current mapping context
      initialContext - the main mapping context containing the destination object
      Returns:
      the DateType annotation of the destination property, or null if not found