Interface Converter<PRESENTATION,MODEL>
-
- Type Parameters:
PRESENTATION
- The presentation type. Must be compatible with whatgetPresentationType()
returns.MODEL
- The model type. Must be compatible with whatgetModelType()
returns.
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AbstractStringToNumberConverter
,DateToLongConverter
,DateToSqlDateConverter
,ReverseConverter
,StringToBigDecimalConverter
,StringToBigIntegerConverter
,StringToBooleanConverter
,StringToByteConverter
,StringToCollectionConverter
,StringToDateConverter
,StringToDoubleConverter
,StringToEnumConverter
,StringToFloatConverter
,StringToIntegerConverter
,StringToLongConverter
,StringToShortConverter
@Deprecated public interface Converter<PRESENTATION,MODEL> extends Serializable
Deprecated.Interface that implements conversion between a model and a presentation type.Typically
convertToPresentation(Object, Class, Locale)
andconvertToModel(Object, Class, Locale)
should be symmetric so that chaining these together returns the original result for all input but this is not a requirement.Converters must not have any side effects (never update UI from inside a converter).
All Converters must be stateless and thread safe.
If conversion of a value fails, a
Converter.ConversionException
is thrown.- Since:
- 7.0
- Author:
- Vaadin Ltd.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Converter.ConversionException
Deprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description MODEL
convertToModel(PRESENTATION value, Class<? extends MODEL> targetType, Locale locale)
Deprecated.Converts the given value from target type to source type.PRESENTATION
convertToPresentation(MODEL value, Class<? extends PRESENTATION> targetType, Locale locale)
Deprecated.Converts the given value from source type to target type.Class<MODEL>
getModelType()
Deprecated.The source type of the converter.Class<PRESENTATION>
getPresentationType()
Deprecated.The target type of the converter.
-
-
-
Method Detail
-
convertToModel
MODEL convertToModel(PRESENTATION value, Class<? extends MODEL> targetType, Locale locale) throws Converter.ConversionException
Deprecated.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 chainingconvertToPresentation(Object, Class, Locale)
andconvertToModel(Object, Class, Locale)
should return the original value.- 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
PRESENTATION convertToPresentation(MODEL value, Class<? extends PRESENTATION> targetType, Locale locale) throws Converter.ConversionException
Deprecated.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 chainingconvertToPresentation(Object, Class, Locale)
andconvertToModel(Object, Class, Locale)
should return the original value.- 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
Class<MODEL> getModelType()
Deprecated.The source type of the converter. Values of this type can be passed toconvertToPresentation(Object, Class, Locale)
.- Returns:
- The source type
-
getPresentationType
Class<PRESENTATION> getPresentationType()
Deprecated.The target type of the converter. Values of this type can be passed toconvertToModel(Object, Class, Locale)
.- Returns:
- The target type
-
-