public class NumberConverter extends java.lang.Object implements PropertyConverter
This class has a static cache of NumberFormats, to avoid
creation and parsing of number formats every time one is used.
| Constructor and Description |
|---|
NumberConverter() |
| Modifier and Type | Method and Description |
|---|---|
protected java.text.Format |
getFormat(java.lang.Class pFormatterClass,
java.lang.Object... pFormat) |
java.lang.Object |
toObject(java.lang.String pString,
java.lang.Class pType,
java.lang.String pFormat)
Converts the string to a number, using the given format for parsing.
|
java.lang.String |
toString(java.lang.Object pObject,
java.lang.String pFormat)
Converts the object to a string, using the given format
|
public java.lang.Object toObject(java.lang.String pString,
java.lang.Class pType,
java.lang.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 java.lang.String toString(java.lang.Object pObject,
java.lang.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 Numberprotected final java.text.Format getFormat(java.lang.Class pFormatterClass,
java.lang.Object... pFormat)
Copyright © 2020. All Rights Reserved.