Class AbstractStringToNumberConverter<T>
- java.lang.Object
-
- com.vaadin.v7.data.util.converter.AbstractStringToNumberConverter<T>
-
- All Implemented Interfaces:
Converter<java.lang.String,T>
,java.io.Serializable
- Direct Known Subclasses:
StringToBigDecimalConverter
,StringToBigIntegerConverter
,StringToByteConverter
,StringToDoubleConverter
,StringToFloatConverter
,StringToIntegerConverter
,StringToLongConverter
,StringToShortConverter
@Deprecated public abstract class AbstractStringToNumberConverter<T> extends java.lang.Object implements Converter<java.lang.String,T>
Deprecated.A converter that converts from the number type T toString
and back. Uses the given locale andNumberFormat
for formatting and parsing. Automatically trims the input string, removing any leading and trailing white space.Override and overwrite
getFormat(Locale)
to use a different format.- Since:
- 7.1
- 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 AbstractStringToNumberConverter()
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected java.lang.Number
convertToNumber(java.lang.String value, java.lang.Class<? extends java.lang.Number> targetType, java.util.Locale locale)
Deprecated.Convert the value to a Number using the given locale andgetFormat(Locale)
.java.lang.String
convertToPresentation(T value, java.lang.Class<? extends java.lang.String> targetType, java.util.Locale locale)
Deprecated.Converts the given value from source type to target type.protected java.text.NumberFormat
getFormat(java.util.Locale locale)
Deprecated.Returns the format used byconvertToPresentation(Object, Class, Locale)
andConverter.convertToModel(Object, Class, Locale)
.java.lang.Class<java.lang.String>
getPresentationType()
Deprecated.The target type of the converter.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.v7.data.util.converter.Converter
convertToModel, getModelType
-
-
-
-
Method Detail
-
getFormat
protected java.text.NumberFormat getFormat(java.util.Locale locale)
Deprecated.Returns the format used byconvertToPresentation(Object, Class, Locale)
andConverter.convertToModel(Object, Class, Locale)
.- Parameters:
locale
- The locale to use- Returns:
- A NumberFormat instance
- Since:
- 7.1
-
convertToNumber
protected java.lang.Number convertToNumber(java.lang.String value, java.lang.Class<? extends java.lang.Number> targetType, java.util.Locale locale) throws Converter.ConversionException
Deprecated.Convert the value to a Number using the given locale andgetFormat(Locale)
.- Parameters:
value
- The value to convertlocale
- The locale to use for conversion- Returns:
- The converted value
- Throws:
Converter.ConversionException
- If there was a problem converting the value- Since:
- 7.1
-
convertToPresentation
public java.lang.String convertToPresentation(T value, java.lang.Class<? extends java.lang.String> targetType, java.util.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<java.lang.String,T>
- 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
-
getPresentationType
public java.lang.Class<java.lang.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<java.lang.String,T>
- Returns:
- The target type
-
-