Class FromDateToZonedDateTimeConverter
java.lang.Object
overit.geocallapp.utilities.rs.converter.ZonedDateTimeConverter
overit.geocallapp.utilities.rs.converter.FromDateToZonedDateTimeConverter
- All Implemented Interfaces:
Converter<Date,,ZonedDateTime> ConditionalConverter<Date,ZonedDateTime>
public class FromDateToZonedDateTimeConverter
extends ZonedDateTimeConverter
implements ConditionalConverter<Date,ZonedDateTime>
A
This converter is designed to be registered with
If there isn't a specific
ConditionalConverter implementation that transforms Date objects into ZonedDateTime objects.This converter is designed to be registered with
M2Mapper and searches for
a TimeZoneResolver for the input entity to use in data conversion.If there isn't a specific
TimeZoneResolver,
a default implementation is used for time zone resolution.- Since:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.modelmapper.spi.ConditionalConverter
ConditionalConverter.MatchResult -
Field Summary
Fields inherited from class overit.geocallapp.utilities.rs.converter.ZonedDateTimeConverter
LOG -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance with default timezone handling.FromDateToZonedDateTimeConverter(TimeZone timeZone) Creates a new instance with a specific time zone. -
Method Summary
Modifier and TypeMethodDescriptionconvert(MappingContext<Date, ZonedDateTime> context) Performs the actual conversion fromDatetoZonedDateTime.Determines if this converter can handle the conversion between the specified source and destination types.Methods inherited from class overit.geocallapp.utilities.rs.converter.ZonedDateTimeConverter
getDateTypeByDestination, getDateTypeBySource, getTimeZone
-
Constructor Details
-
FromDateToZonedDateTimeConverter
public FromDateToZonedDateTimeConverter()Creates a new instance with default timezone handling. -
FromDateToZonedDateTimeConverter
Creates a new instance with a specific time zone.- Parameters:
timeZone- theTimeZoneto use for conversions
-
-
Method Details
-
match
Determines if this converter can handle the conversion between the specified source and destination types. Returns FULL match if source type is assignable fromDateand destination type is assignable fromZonedDateTime.- Specified by:
matchin interfaceConditionalConverter<Date,ZonedDateTime> - Parameters:
sourceType- the source class type to evaluate for conversion compatibilitydestinationType- the destination class type to evaluate for conversion compatibility- Returns:
ConditionalConverter.MatchResult.FULLif conversion is supported,ConditionalConverter.MatchResult.NONEotherwise
-
convert
Performs the actual conversion fromDatetoZonedDateTime. Handles special cases for DATE_MIN and DATE_MAX values, and uses timezone resolution based on the destination entity type. The conversion process considersDateTypeannotations to determine whether to use local or central timezone handling.- Specified by:
convertin interfaceConverter<Date,ZonedDateTime> - Parameters:
context- the mapping context containing sourceDateand destinationZonedDateTimeinformation- Returns:
- the converted
ZonedDateTimeobject, or the existing destination if source is null
-