public class DateToSqlDateConverter extends Object implements Converter<Date,Date>
Date and
Date. 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 from Date to Date.Converter.ConversionException| Constructor and Description |
|---|
DateToSqlDateConverter() |
| Modifier and Type | Method and Description |
|---|---|
Date |
convertToModel(Date value,
Class<? extends Date> targetType,
Locale locale)
Converts the given value from target type to source type.
|
Date |
convertToPresentation(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.
|
public Date convertToModel(Date value, Class<? extends Date> targetType, Locale locale) throws Converter.ConversionException
ConverterA converter can optionally use locale to do the conversion.
A converter should in most cases be symmetric so chainingConverter.convertToPresentation(Object, Class, Locale) and
Converter.convertToModel(Object, Class, Locale) should return the original
value.convertToModel in interface Converter<Date,Date>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.Converter.ConversionException - If the value could not be convertedpublic Date convertToPresentation(Date value, Class<? extends Date> targetType, Locale locale) throws Converter.ConversionException
ConverterA converter can optionally use locale to do the conversion.
A converter should in most cases be symmetric so chainingConverter.convertToPresentation(Object, Class, Locale) and
Converter.convertToModel(Object, Class, Locale) should return the original
value.convertToPresentation in interface Converter<Date,Date>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.Converter.ConversionException - If the value could not be convertedpublic Class<Date> getModelType()
ConverterConverter.convertToPresentation(Object, Class, Locale).getModelType in interface Converter<Date,Date>public Class<Date> getPresentationType()
ConverterConverter.convertToModel(Object, Class, Locale).getPresentationType in interface Converter<Date,Date>Copyright © 2019 Vaadin Ltd. All rights reserved.