Package com.vaadin.data.util.converter
Class DateToLongConverter
- java.lang.Object
-
- com.vaadin.data.util.converter.DateToLongConverter
-
- All Implemented Interfaces:
Converter<Date,Long>
,Serializable
public class DateToLongConverter extends Object implements Converter<Date,Long>
- Since:
- 7.0
- 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 DateToLongConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Long
convertToModel(Date value, Class<? extends Long> targetType, Locale locale)
Converts the given value from target type to source type.Date
convertToPresentation(Long value, Class<? extends Date> targetType, Locale locale)
Converts the given value from source type to target type.Class<Long>
getModelType()
The source type of the converter.Class<Date>
getPresentationType()
The target type of the converter.
-
-
-
Method Detail
-
convertToModel
public Long convertToModel(Date value, Class<? extends Long> targetType, Locale locale)
Description copied from interface:Converter
Converts 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:
convertToModel
in interfaceConverter<Date,Long>
- 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
-
convertToPresentation
public Date convertToPresentation(Long value, Class<? extends Date> targetType, Locale locale)
Description copied from interface:Converter
Converts 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:
convertToPresentation
in interfaceConverter<Date,Long>
- 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
-
getModelType
public Class<Long> getModelType()
Description copied from interface:Converter
The source type of the converter. Values of this type can be passed toConverter.convertToPresentation(Object, Class, Locale)
.- Specified by:
getModelType
in interfaceConverter<Date,Long>
- Returns:
- The source type
-
getPresentationType
public Class<Date> getPresentationType()
Description copied from interface:Converter
The target type of the converter. Values of this type can be passed toConverter.convertToModel(Object, Class, Locale)
.- Specified by:
getPresentationType
in interfaceConverter<Date,Long>
- Returns:
- The target type
-
-