Class LocalDateTimeToInstantConverter

java.lang.Object
com.vaadin.flow.data.converter.LocalDateTimeToInstantConverter
All Implemented Interfaces:
Converter<LocalDateTime,Instant>, Serializable

public class LocalDateTimeToInstantConverter extends Object implements Converter<LocalDateTime,Instant>
A converter that converts between LocalDateTime and Instant.
See Also:
  • Constructor Details

    • LocalDateTimeToInstantConverter

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

    • convertToModel

      public Result<Instant> convertToModel(LocalDateTime localDateTime, 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<LocalDateTime,Instant>
      Parameters:
      localDateTime - 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 LocalDateTime convertToPresentation(Instant instant, 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<LocalDateTime,Instant>
      Parameters:
      instant - The value to convert. Can be null
      context - The value context for the conversion.
      Returns:
      The converted value compatible with the source type