Class LocalDateToDateConverter

java.lang.Object
com.vaadin.flow.data.converter.LocalDateToDateConverter
All Implemented Interfaces:
Converter<LocalDate,Date>, Serializable

public class LocalDateToDateConverter extends Object implements Converter<LocalDate,Date>
A converter that converts between LocalDate and Date.
Since:
1.0
Author:
Vaadin Ltd
See Also:
  • Constructor Details

    • LocalDateToDateConverter

      public LocalDateToDateConverter(ZoneId zoneId)
      Creates a new converter using the given time zone.
      Parameters:
      zoneId - the time zone id to use, not null
    • LocalDateToDateConverter

      public LocalDateToDateConverter()
      Creates a new converter using the system's default time zone.
      See Also:
  • Method Details

    • convertToModel

      public Result<Date> convertToModel(LocalDate 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 interface Converter<LocalDate,Date>
      Parameters:
      localDate - The value to convert. Can be null
      context - The value context for the conversion.
      Returns:
      The converted value compatible with the source type
    • convertToPresentation

      public LocalDate 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 interface Converter<LocalDate,Date>
      Parameters:
      date - The value to convert. Can be null
      context - The value context for the conversion.
      Returns:
      The converted value compatible with the source type