Package com.bc.ceres.binding.converters
Class NumberConverter<T extends Number>
- java.lang.Object
-
- com.bc.ceres.binding.converters.NumberConverter<T>
-
- All Implemented Interfaces:
Converter<T>
- Direct Known Subclasses:
ByteConverter,DoubleConverter,FloatConverter,IntegerConverter,LongConverter,ShortConverter
public abstract class NumberConverter<T extends Number> extends Object implements Converter<T>
-
-
Constructor Summary
Constructors Constructor Description NumberConverter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Stringformat(T value)Converts a value of the type returned byConverter.getValueType()to its plain text representation.abstract Class<? extends T>getValueType()Gets the value type.Tparse(String value)Converts a value from its plain text representation to a Java object instance of the type returned byConverter.getValueType().protected abstract TparseNumber(String value)
-
-
-
Method Detail
-
getValueType
public abstract Class<? extends T> getValueType()
Description copied from interface:ConverterGets the value type.- Specified by:
getValueTypein interfaceConverter<T extends Number>- Returns:
- The value type.
-
parse
public T parse(String value) throws ConversionException
Description copied from interface:ConverterConverts a value from its plain text representation to a Java object instance of the type returned byConverter.getValueType().- Specified by:
parsein interfaceConverter<T extends Number>- Parameters:
value- The textual representation of the value.- Returns:
- The converted value.
- Throws:
ConversionException- If the conversion fails.
-
parseNumber
protected abstract T parseNumber(String value) throws NumberFormatException
- Throws:
NumberFormatException
-
format
public String format(T value)
Description copied from interface:ConverterConverts a value of the type returned byConverter.getValueType()to its plain text representation.
-
-