|
JIDE Common Layer 2.7.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jidesoft.converter.NumberConverter
public abstract class NumberConverter
Converter which converts Number to String and converts it back. You can pass in a NumberFormat as UserObject of ConverterContext if you want to control the format of the number such as maximum decimal point etc.
Field Summary | |
---|---|
static ConverterContext |
CONTEXT_FRACTION_NUMBER
|
Constructor Summary | |
---|---|
NumberConverter()
Creates a number converter with no NumberFormat. |
|
NumberConverter(java.text.NumberFormat format)
Creates the number converter with a specified NumberFormat. |
Method Summary | |
---|---|
protected java.text.NumberFormat |
getDefaultNumberFormat()
Gets the NumberFormat for Locale.US. |
protected java.text.NumberFormat |
getNumberFormat()
Gets the NumberFormat. |
static boolean |
isGroupingUsed()
Gets flag if the grouping is used for the format. |
protected java.lang.Number |
parseNumber(java.lang.String string)
Parse the string as number. |
void |
setCurrency(java.util.Currency currency)
Set the currency of this converter. |
void |
setFractionDigits(int minDigits,
int maxDigits)
Set the fraction digits of this converter. |
static void |
setGroupingUsed(boolean groupingUsed)
Sets if the grouping will be used for the NumberFormat. |
void |
setIntegerDigits(int minDigits,
int maxDigits)
Set the integer digits of this converter. |
void |
setNumberFormat(java.text.NumberFormat numberFormat)
|
void |
setRoundingMode(java.math.RoundingMode mode)
Set the rounding mode of this converter. |
boolean |
supportToString(java.lang.Object object,
ConverterContext context)
If it supports toString method. |
java.lang.String |
toString(java.lang.Object object,
ConverterContext context)
Converts from object to String based on current locale. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.jidesoft.converter.ObjectConverter |
---|
fromString, supportFromString |
Field Detail |
---|
public static final ConverterContext CONTEXT_FRACTION_NUMBER
Constructor Detail |
---|
public NumberConverter()
public NumberConverter(java.text.NumberFormat format)
format
- the number format.Method Detail |
---|
public java.lang.String toString(java.lang.Object object, ConverterContext context)
ObjectConverter
toString
in interface ObjectConverter
object
- object to be convertedcontext
- converter context to be used
public boolean supportToString(java.lang.Object object, ConverterContext context)
ObjectConverter
supportToString
in interface ObjectConverter
object
- object to be convertedcontext
- converter context to be used
public void setNumberFormat(java.text.NumberFormat numberFormat)
protected java.text.NumberFormat getNumberFormat()
protected java.text.NumberFormat getDefaultNumberFormat()
protected java.lang.Number parseNumber(java.lang.String string)
string
- the string
public static boolean isGroupingUsed()
public static void setGroupingUsed(boolean groupingUsed)
groupingUsed
- true or false.public void setFractionDigits(int minDigits, int maxDigits)
minDigits
- minimum fraction digitsmaxDigits
- maximum fraction digitspublic void setCurrency(java.util.Currency currency)
currency
- currencypublic void setIntegerDigits(int minDigits, int maxDigits)
minDigits
- minimum integer digitsmaxDigits
- maximum integer digitspublic void setRoundingMode(java.math.RoundingMode mode)
mode
- rounding mode
|
JIDE Common Layer 2.7.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |