|
JIDE 3.5.15 | ||||||||
| 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(NumberFormat format)
Creates the number converter with a specified NumberFormat. |
|
| Method Summary | |
|---|---|
protected NumberFormat |
getDefaultNumberFormat()
Gets the NumberFormat for Locale.US. |
protected NumberFormat |
getNumberFormat()
Gets the NumberFormat. |
boolean |
isAvoidNegativeZero()
Gets the flag indicating if negative zero should be avoided. |
static boolean |
isGroupingUsed()
Gets flag if the grouping is used for the format. |
protected Number |
parseNumber(String string)
Parse the string as number. |
void |
setAvoidNegativeZero(boolean avoidNegativeZero)
Sets the flag indicating if negative zero should be avoided. |
void |
setCurrency(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(NumberFormat numberFormat)
|
void |
setRoundingMode(RoundingMode mode)
Set the rounding mode of this converter. |
boolean |
supportToString(Object object,
ConverterContext context)
If it supports toString method. |
String |
toString(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(NumberFormat format)
format - the number format.| Method Detail |
|---|
public String toString(Object object,
ConverterContext context)
ObjectConverter
toString in interface ObjectConverterobject - object to be convertedcontext - converter context to be used
public boolean supportToString(Object object,
ConverterContext context)
ObjectConverter
supportToString in interface ObjectConverterobject - object to be convertedcontext - converter context to be used
public void setNumberFormat(NumberFormat numberFormat)
protected NumberFormat getNumberFormat()
protected NumberFormat getDefaultNumberFormat()
protected Number parseNumber(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(Currency currency)
currency - currency
public void setIntegerDigits(int minDigits,
int maxDigits)
minDigits - minimum integer digitsmaxDigits - maximum integer digitspublic void setRoundingMode(RoundingMode mode)
mode - rounding modepublic boolean isAvoidNegativeZero()
setAvoidNegativeZero(boolean)public void setAvoidNegativeZero(boolean avoidNegativeZero)
avoidNegativeZero - the flag
|
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||