Class StringToDateConverter
- java.lang.Object
-
- com.vaadin.v7.data.util.converter.StringToDateConverter
-
- All Implemented Interfaces:
Converter<String,Date>
,Serializable
@Deprecated public class StringToDateConverter extends Object implements Converter<String,Date>
Deprecated.A converter that converts fromDate
toString
and back. Uses the given locale andDateFormat
for formatting and parsing.Leading and trailing white spaces are ignored when converting from a String.
Override and overwrite
getFormat(Locale)
to use a different format.- Since:
- 7.0
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.vaadin.v7.data.util.converter.Converter
Converter.ConversionException
-
-
Constructor Summary
Constructors Constructor Description StringToDateConverter()
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Date
convertToModel(String value, Class<? extends Date> targetType, Locale locale)
Deprecated.Converts the given value from target type to source type.String
convertToPresentation(Date value, Class<? extends String> targetType, Locale locale)
Deprecated.Converts the given value from source type to target type.protected DateFormat
getFormat(Locale locale)
Deprecated.Returns the format used byconvertToPresentation(Date, Class,Locale)
andconvertToModel(String, Class, Locale)
.Class<Date>
getModelType()
Deprecated.The source type of the converter.Class<String>
getPresentationType()
Deprecated.The target type of the converter.
-
-
-
Method Detail
-
getFormat
protected DateFormat getFormat(Locale locale)
Deprecated.Returns the format used byconvertToPresentation(Date, Class,Locale)
andconvertToModel(String, Class, Locale)
.- Parameters:
locale
- The locale to use- Returns:
- A DateFormat instance
-
convertToModel
public Date convertToModel(String value, Class<? extends Date> targetType, Locale locale) throws Converter.ConversionException
Deprecated.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<String,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 String convertToPresentation(Date value, Class<? extends String> targetType, Locale locale) throws Converter.ConversionException
Deprecated.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<String,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()
Deprecated.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<String,Date>
- Returns:
- The source type
-
getPresentationType
public Class<String> getPresentationType()
Deprecated.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<String,Date>
- Returns:
- The target type
-
-