Class DateToSqlDateConverter

  • All Implemented Interfaces:
    Converter<java.util.Date,​java.sql.Date>, java.io.Serializable

    public class DateToSqlDateConverter
    extends java.lang.Object
    implements Converter<java.util.Date,​java.sql.Date>
    Converter for handling conversion between Date and Date. This is used when a PopupDateField or InlineDateField is connected to a java.sql.Date property. Note that information (time information) is lost when converting from Date to Date.
    Since:
    8.0
    Author:
    Vaadin Ltd
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Result<java.sql.Date> convertToModel​(java.util.Date value, ValueContext context)
      Converts the given value from model type to presentation type.
      java.util.Date convertToPresentation​(java.sql.Date value, ValueContext context)
      Converts the given value from presentation type to model type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DateToSqlDateConverter

        public DateToSqlDateConverter()
    • Method Detail

      • convertToModel

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