aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/data/util/converter/DateToLongConverter.java
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/com/vaadin/data/util/converter/DateToLongConverter.java')
-rw-r--r--server/src/com/vaadin/data/util/converter/DateToLongConverter.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/server/src/com/vaadin/data/util/converter/DateToLongConverter.java b/server/src/com/vaadin/data/util/converter/DateToLongConverter.java
index 82dccdcacc..6aedc74f6d 100644
--- a/server/src/com/vaadin/data/util/converter/DateToLongConverter.java
+++ b/server/src/com/vaadin/data/util/converter/DateToLongConverter.java
@@ -32,10 +32,11 @@ public class DateToLongConverter implements Converter<Date, Long> {
*
* @see
* com.vaadin.data.util.converter.Converter#convertToModel(java.lang.Object,
- * java.util.Locale)
+ * java.lang.Class, java.util.Locale)
*/
@Override
- public Long convertToModel(Date value, Locale locale) {
+ public Long convertToModel(Date value, Class<? extends Long> targetType,
+ Locale locale) {
if (value == null) {
return null;
}
@@ -48,10 +49,16 @@ public class DateToLongConverter implements Converter<Date, Long> {
*
* @see
* com.vaadin.data.util.converter.Converter#convertToPresentation(java.lang
- * .Object, java.util.Locale)
+ * .Object, java.lang.Class, java.util.Locale)
*/
@Override
- public Date convertToPresentation(Long value, Locale locale) {
+ public Date convertToPresentation(Long value,
+ Class<? extends Date> targetType, Locale locale) {
+ if (targetType != getPresentationType()) {
+ throw new ConversionException("Converter only supports "
+ + getPresentationType().getName() + " (targetType was "
+ + targetType.getName() + ")");
+ }
if (value == null) {
return null;
}