Package com.vaadin.data.util.converter
Class DateToSqlDateConverter
- java.lang.Object
-
- com.vaadin.data.util.converter.DateToSqlDateConverter
-
- All Implemented Interfaces:
Converter<Date,Date>,Serializable
public class DateToSqlDateConverter extends Object implements Converter<Date,Date>
Converter for handling conversion betweenDateandDate. This is used when a PopupDateField or InlineDateField is connected to a java.sql.Date property, typically through a JPAContainer or SQLContainer. Note that information (time information) is lost when converting fromDatetoDate.- Since:
- 7.1
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.vaadin.data.util.converter.Converter
Converter.ConversionException
-
-
Constructor Summary
Constructors Constructor Description DateToSqlDateConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DateconvertToModel(Date value, Class<? extends Date> targetType, Locale locale)Converts the given value from target type to source type.DateconvertToPresentation(Date value, Class<? extends Date> targetType, Locale locale)Converts the given value from source type to target type.Class<Date>getModelType()The source type of the converter.Class<Date>getPresentationType()The target type of the converter.
-
-
-
Method Detail
-
convertToModel
public Date convertToModel(Date value, Class<? extends Date> targetType, Locale locale) throws Converter.ConversionException
Description copied from interface:ConverterConverts the given value from target type to source type.A converter can optionally use locale to do the conversion.
A converter should in most cases be symmetric so chainingConverter.convertToPresentation(Object, Class, Locale)andConverter.convertToModel(Object, Class, Locale)should return the original value.- Specified by:
convertToModelin interfaceConverter<Date,Date>- Parameters:
value- The value to convert, compatible with the target type. Can be nulltargetType- The requested type of the return valuelocale- The locale to use for conversion. Can be null.- Returns:
- The converted value compatible with the source type
- Throws:
Converter.ConversionException- If the value could not be converted
-
convertToPresentation
public Date convertToPresentation(Date value, Class<? extends Date> targetType, Locale locale) throws Converter.ConversionException
Description copied from interface:ConverterConverts the given value from source type to target type.A converter can optionally use locale to do the conversion.
A converter should in most cases be symmetric so chainingConverter.convertToPresentation(Object, Class, Locale)andConverter.convertToModel(Object, Class, Locale)should return the original value.- Specified by:
convertToPresentationin interfaceConverter<Date,Date>- Parameters:
value- The value to convert, compatible with the target type. Can be nulltargetType- The requested type of the return valuelocale- The locale to use for conversion. Can be null.- Returns:
- The converted value compatible with the source type
- Throws:
Converter.ConversionException- If the value could not be converted
-
getModelType
public Class<Date> getModelType()
Description copied from interface:ConverterThe source type of the converter. Values of this type can be passed toConverter.convertToPresentation(Object, Class, Locale).- Specified by:
getModelTypein interfaceConverter<Date,Date>- Returns:
- The source type
-
getPresentationType
public Class<Date> getPresentationType()
Description copied from interface:ConverterThe target type of the converter. Values of this type can be passed toConverter.convertToModel(Object, Class, Locale).- Specified by:
getPresentationTypein interfaceConverter<Date,Date>- Returns:
- The target type
-
-