Class FromLocalTimeToDateConverter
java.lang.Object
overit.geocallapp.utilities.rs.converter.FromLocalTimeToDateConverter
public class FromLocalTimeToDateConverter
extends Object
implements ConditionalConverter<LocalTime,Date>
A
This converter combines the time with
The converter is designed to be registered with
ConditionalConverter implementation that transforms LocalTime objects into Date objects.This converter combines the time with
LocalDate.EPOCH and converts it to a Date using the system default timezone.The converter is designed to be registered with
M2Mapper for automatic time-to-date conversions during object mapping.- Since:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.modelmapper.spi.ConditionalConverter
ConditionalConverter.MatchResult -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvert(MappingContext<LocalTime, Date> context) Determines if this converter can handle the conversion between the specified source and destination types.
-
Constructor Details
-
FromLocalTimeToDateConverter
public FromLocalTimeToDateConverter()Creates a new instance of the converter.
-
-
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 fromLocalTimeand destination type is assignable fromDate.- Specified by:
matchin interfaceConditionalConverter<LocalTime,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 fromLocalTimetoDate. Combines the source time withLocalDate.EPOCHand converts it to aDateusing the system default timezone. If the sourceLocalTimeis null, returns the existing destination value.
-