|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vaadin.data.util.converter.AbstractStringToNumberConverter<java.math.BigDecimal>
com.vaadin.data.util.converter.StringToBigDecimalConverter
public class StringToBigDecimalConverter
A converter that converts from String to BigDecimal and back.
Uses the given locale and a NumberFormat instance 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 | |
|---|---|
StringToBigDecimalConverter()
|
|
| Method Summary | |
|---|---|
java.math.BigDecimal |
convertToModel(java.lang.String value,
java.lang.Class<? extends java.math.BigDecimal> targetType,
java.util.Locale locale)
Converts the given value from target type to source type. |
protected java.text.NumberFormat |
getFormat(java.util.Locale locale)
Returns the format used by #convertToPresentation(Object, Locale)
and #convertToModel(Object, Locale). |
java.lang.Class<java.math.BigDecimal> |
getModelType()
The source type of the converter. |
| Methods inherited from class com.vaadin.data.util.converter.AbstractStringToNumberConverter |
|---|
convertToNumber, convertToPresentation, getPresentationType |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StringToBigDecimalConverter()
| Method Detail |
|---|
protected java.text.NumberFormat getFormat(java.util.Locale locale)
AbstractStringToNumberConverter#convertToPresentation(Object, Locale)
and #convertToModel(Object, Locale).
getFormat in class AbstractStringToNumberConverter<java.math.BigDecimal>locale - The locale to use
public java.math.BigDecimal convertToModel(java.lang.String value,
java.lang.Class<? extends java.math.BigDecimal> targetType,
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, Class, Locale) and
Converter.convertToModel(Object, Class, Locale) should return the original
value.
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.
Converter.ConversionException - If the value could not be convertedpublic java.lang.Class<java.math.BigDecimal> getModelType()
ConverterConverter.convertToPresentation(Object, Class, Locale).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||