PropertyConverterDateConverter, TimeConverterpublic class NumberConverter extends Object implements PropertyConverter
NumberFormats, to avoid
creation and parsing of number formats every time one is used.| Constructor | Description |
|---|---|
NumberConverter() |
| Modifier and Type | Method | Description |
|---|---|---|
protected Format |
getFormat(Class pFormatterClass,
Object... pFormat) |
|
Object |
toObject(String pString,
Class pType,
String pFormat) |
Converts the string to a number, using the given format for parsing.
|
String |
toString(Object pObject,
String pFormat) |
Converts the object to a string, using the given format
|
public Object toObject(String pString, Class pType, String pFormat) throws ConversionException
toObject in interface PropertyConverterpString - the string to convert.pType - the type to convert to. PropertyConverter
implementations may choose to ignore this parameter.pFormat - the format used for parsing. PropertyConverter
implementations may choose to ignore this parameter. Also,
implementations that require a parser format, should provide a default
format, and allow null as the format argument.java.lang.Number or the class of the type parameter.ConversionExceptionNumber,
NumberFormatpublic String toString(Object pObject, String pFormat) throws ConversionException
toString in interface PropertyConverterpObject - the object to convert.pFormat - the format used for parsing. PropertyConverter
implementations may choose to ignore this parameter. Also,
implementations that require a parser format, should provide a default
format, and allow null as the format argument.ConversionException - if the object is not a subclass of NumberCopyright © 2018. All rights reserved.