Class FromZonedDateTimeRangeToDateTimeRangeConverter
java.lang.Object
overit.geocallapp.utilities.rs.converter.ZonedDateTimeConverter
overit.geocallapp.utilities.rs.converter.FromZonedDateTimeRangeToDateTimeRangeConverter
- All Implemented Interfaces:
Converter<ZonedDateTimeRange,,DateTimeRange> ConditionalConverter<ZonedDateTimeRange,DateTimeRange>
public class FromZonedDateTimeRangeToDateTimeRangeConverter
extends ZonedDateTimeConverter
implements ConditionalConverter<ZonedDateTimeRange,DateTimeRange>
A
This converter is designed to be registered with M2Mapper and searches for a
If there isn't a specific
ConditionalConverter implementation that transforms ZonedDateTimeRange objects into DateTimeRange 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 timezone handling.Creates a new instance of the converter with a specific timezone. -
Method Summary
Modifier and TypeMethodDescriptionconvert(MappingContext<ZonedDateTimeRange, DateTimeRange> context) Performs the actual conversion fromZonedDateTimeRangetoDateTimeRange.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
-
FromZonedDateTimeRangeToDateTimeRangeConverter
public FromZonedDateTimeRangeToDateTimeRangeConverter()Creates a new instance of the converter with default timezone handling. -
FromZonedDateTimeRangeToDateTimeRangeConverter
Creates a new instance of the converter with a specific timezone.- Parameters:
timeZone- theTimeZoneto use for conversions
-
-
Method Details
-
match
Determines if this converter can handle the conversion between the specified source and destination types. IMPORTANT: This particular converter is added as post converter on the mapper, therefore it is not used for direct conversion- Specified by:
matchin interfaceConditionalConverter<ZonedDateTimeRange,DateTimeRange> - Parameters:
sourceType- the source class type to evaluate for conversion compatibilitydestinationType- the destination class type to evaluate for conversion compatibility- Returns:
ConditionalConverter.MatchResult.NONEas this converter is not used for direct conversion
-
convert
Performs the actual conversion fromZonedDateTimeRangetoDateTimeRange. Converts both the from and to dates usingDateTypeannotations to determine the appropriate conversion strategy. If the sourceZonedDateTimeRangee is null, returns the existing destination value.- Specified by:
convertin interfaceConverter<ZonedDateTimeRange,DateTimeRange> - Parameters:
context- the mapping context containing sourceZonedDateTimeRangeand destinationDateTimeRangeinformation- Returns:
- the converted
DateTimeRangeobject, or the existing destination if source is null
-