public abstract class NumberConverter<T extends Number> extends FormatableConverter<T>
| Modifier and Type | Field and Description |
|---|---|
protected com.google.gwt.i18n.client.NumberFormat |
numberFormat |
logger| Constructor and Description |
|---|
NumberConverter() |
NumberConverter(com.google.gwt.i18n.client.NumberFormat numberFormat) |
NumberConverter(String format) |
| Modifier and Type | Method and Description |
|---|---|
T |
convert(String value)
Converts the specified value to the type T.
|
protected T |
convertWithFormat(String value) |
protected abstract T |
convertWithoutFormat(String value) |
protected abstract T |
newInstance(double parsed) |
protected double |
parseInternal(String value) |
String |
serialize(T value)
Implementation based on
String.valueOf(Object). |
protected String |
serializeWithFormat(T value) |
getFormatisValidpublic NumberConverter()
public NumberConverter(String format)
format - IllegalArgumentException - If the format is an illegal number formatpublic NumberConverter(com.google.gwt.i18n.client.NumberFormat numberFormat)
numberFormat - Must not be null! Otherwise a NullPointerException
will be thrown.NullPointerException - if numberFormat is nullpublic T convert(String value)
Convertervalue - The string to be converted. May be null.null if a conversion is not
possibleprotected abstract T newInstance(double parsed)
protected double parseInternal(String value)
public String serialize(T value)
AbstractConverterString.valueOf(Object).serialize in interface Converter<T extends Number>serialize in class AbstractConverter<T extends Number>value - The value to serialize. May be null.null if no value was given.name.pehl.piriti.converter.client.Converter#serialize(java.lang.Object,
java.lang.String)Copyright © 2012 Harald Pehl. All Rights Reserved.