Class FromZonedDateTimeToDateConverter
java.lang.Object
overit.geocallapp.utilities.rs.converter.ZonedDateTimeConverter
overit.geocallapp.utilities.rs.converter.FromZonedDateTimeToDateConverter
- All Implemented Interfaces:
Converter<ZonedDateTime,,Date> ConditionalConverter<ZonedDateTime,Date>
public class FromZonedDateTimeToDateConverter
extends ZonedDateTimeConverter
implements ConditionalConverter<ZonedDateTime,Date>
A
This converter is designed to be registered with M2Mapper and searches for a
If there isn't a specific
ConditionalConverter implementation that transforms ZonedDateTime objects into Date 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 associated with the system TimeZone is used.- 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 of the converter with default time zone handling.FromZonedDateTimeToDateConverter(TimeZone timeZone) Creates a new instance of the converter with a specific time zone. -
Method Summary
Modifier and TypeMethodDescriptionconvert(MappingContext<ZonedDateTime, Date> context) Performs the actual conversion fromZonedDateTimetoDate.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
-
FromZonedDateTimeToDateConverter
public FromZonedDateTimeToDateConverter()Creates a new instance of the converter with default time zone handling. -
FromZonedDateTimeToDateConverter
Creates a new instance of the converter 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 fromZonedDateTimeand destination type is assignable fromDate.- Specified by:
matchin interfaceConditionalConverter<ZonedDateTime,Date> - 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 fromZonedDateTimetoDate. UsesDateTypeannotations to determine the appropriate conversion strategy (local, central, or symbolic). If the sourceZonedDateTimeis null, returns the existing destination value.- Specified by:
convertin interfaceConverter<ZonedDateTime,Date> - Parameters:
context- the mapping context containing sourceZonedDateTimeand destinationDateinformation- Returns:
- the converted
Dateobject, or the existing destination if source is null
-