com.vaadin.flow.data.converter.
Class LocalDateTimeToDateConverter
- java.lang.Object
-
- com.vaadin.flow.data.converter.LocalDateTimeToDateConverter
-
All Implemented Interfaces:
public class LocalDateTimeToDateConverter extends Object implements Converter<LocalDateTime,Date>
A converter that converts between
LocalDateTime
andDate
.Since:
1.0
Author:
Vaadin Ltd
See Also:
-
-
Constructor Summary
Constructors Constructor Description LocalDateTimeToDateConverter(ZoneId zoneId)
Creates a new converter using the given time zone.
-
Method Summary
All Methods Modifier and Type Method Description Result<Date>
convertToModel(LocalDateTime localDate, ValueContext context)
Converts the given value from presentation type to model type.
LocalDateTime
convertToPresentation(Date date, ValueContext context)
Converts the given value from model type to presentation type.
-
-
-
Constructor Detail
-
LocalDateTimeToDateConverter
public LocalDateTimeToDateConverter(ZoneId zoneId)
Creates a new converter using the given time zone.
Parameters:
zoneId
- the time zone to use, notnull
-
-
Method Detail
-
convertToModel
public Result<Date> convertToModel(LocalDateTime localDate, ValueContext context)
Description copied from interface:
Converter
Converts the given value from presentation type to model type.
A converter can optionally use locale to do the conversion.
Specified by:
convertToModel
in interfaceConverter<LocalDateTime,Date>
Parameters:
localDate
- The value to convert. Can be nullcontext
- The value context for the conversion.Returns:
The converted value compatible with the source type
-
convertToPresentation
public LocalDateTime convertToPresentation(Date date, ValueContext context)
Description copied from interface:
Converter
Converts the given value from model type to presentation type.
A converter can optionally use locale to do the conversion.
Specified by:
convertToPresentation
in interfaceConverter<LocalDateTime,Date>
Parameters:
date
- The value to convert. Can be nullcontext
- The value context for the conversion.Returns:
The converted value compatible with the source type
-
-