Package com.vaadin.data.converter
Class LocalDateTimeToDateConverter
- java.lang.Object
-
- com.vaadin.data.converter.LocalDateTimeToDateConverter
-
- All Implemented Interfaces:
Converter<java.time.LocalDateTime,java.util.Date>,java.io.Serializable
public class LocalDateTimeToDateConverter extends java.lang.Object implements Converter<java.time.LocalDateTime,java.util.Date>
A converter that converts betweenLocalDateTimeandDate. This is used when aDateTimeFieldorInlineDateTimeFieldis bound to aDateproperty.- Since:
- 8.0
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LocalDateTimeToDateConverter(java.time.ZoneId zoneId)Creates a new converter using the given time zone.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Result<java.util.Date>convertToModel(java.time.LocalDateTime localDate, ValueContext context)Converts the given value from model type to presentation type.java.time.LocalDateTimeconvertToPresentation(java.util.Date date, ValueContext context)Converts the given value from presentation type to model type.
-
-
-
Method Detail
-
convertToModel
public Result<java.util.Date> convertToModel(java.time.LocalDateTime localDate, ValueContext context)
Description copied from interface:ConverterConverts the given value from model type to presentation type.A converter can optionally use locale to do the conversion.
- Specified by:
convertToModelin interfaceConverter<java.time.LocalDateTime,java.util.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 java.time.LocalDateTime convertToPresentation(java.util.Date date, ValueContext context)Description copied from interface:ConverterConverts the given value from presentation type to model type.A converter can optionally use locale to do the conversion.
- Specified by:
convertToPresentationin interfaceConverter<java.time.LocalDateTime,java.util.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
-
-