|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vaadin.data.util.converter.StringToDateConverter
public class StringToDateConverter
A converter that converts from Date to String and back. Uses
the given locale and DateFormat 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.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.vaadin.data.util.converter.Converter |
|---|
Converter.ConversionException |
| Constructor Summary | |
|---|---|
StringToDateConverter()
|
|
| Method Summary | |
|---|---|
java.util.Date |
convertToModel(java.lang.String value,
java.util.Locale locale)
Converts the given value from target type to source type. |
java.lang.String |
convertToPresentation(java.util.Date value,
java.util.Locale locale)
Converts the given value from source type to target type. |
protected java.text.DateFormat |
getFormat(java.util.Locale locale)
Returns the format used by convertToPresentation(Date, Locale)
and convertToModel(String, Locale). |
java.lang.Class<java.util.Date> |
getModelType()
The source type of the converter. |
java.lang.Class<java.lang.String> |
getPresentationType()
The target type of the converter. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StringToDateConverter()
| Method Detail |
|---|
protected java.text.DateFormat getFormat(java.util.Locale locale)
convertToPresentation(Date, Locale)
and convertToModel(String, Locale).
locale - The locale to use
public java.util.Date convertToModel(java.lang.String value,
java.util.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, Locale) and
Converter.convertToModel(Object, Locale) should return the original value.
convertToModel in interface Converter<java.lang.String,java.util.Date>value - The value to convert, compatible with the target type. Can be
nulllocale - The locale to use for conversion. Can be null.
Converter.ConversionException - If the value could not be converted
public java.lang.String convertToPresentation(java.util.Date value,
java.util.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, Locale) and
Converter.convertToModel(Object, Locale) should return the original value.
convertToPresentation in interface Converter<java.lang.String,java.util.Date>value - The value to convert, compatible with the target type. Can be
nulllocale - The locale to use for conversion. Can be null.
Converter.ConversionException - If the value could not be convertedpublic java.lang.Class<java.util.Date> getModelType()
ConverterConverter.convertToPresentation(Object, Locale).
getModelType in interface Converter<java.lang.String,java.util.Date>public java.lang.Class<java.lang.String> getPresentationType()
ConverterConverter.convertToModel(Object, Locale).
getPresentationType in interface Converter<java.lang.String,java.util.Date>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||