|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.text.Format
org.dhmp.util.NumberFormat
org.dhmp.util.DecimalFormat
DecimalFormat used internally. It has modified to support setParseBigDecimal.
| Nested Class Summary | |
static class |
NumberFormat.Field
|
| Field Summary | |
static int |
FRACTION_FIELD
This is a constant used to create a FieldPosition object
that will return the fractional portion of a formatted number. |
static int |
INTEGER_FIELD
This is a constant used to create a FieldPosition object
that will return the integer portion of a formatted number. |
| Constructor Summary | |
DecimalFormat()
Constructs a DecimalFormat which uses the default
pattern and symbols. |
|
DecimalFormat(java.lang.String pattern)
Constructs a DecimalFormat which uses the given
pattern and the default symbols for formatting and parsing. |
|
DecimalFormat(java.lang.String pattern,
java.text.DecimalFormatSymbols symbols)
Constructs a DecimalFormat using the given pattern
and formatting symbols. |
|
| Method Summary | |
void |
applyLocalizedPattern(java.lang.String pattern)
|
void |
applyPattern(java.lang.String pattern)
|
java.lang.Object |
clone()
|
boolean |
equals(java.lang.Object obj)
Tests this instance for equality with an arbitrary object. |
java.lang.String |
format(double number)
This method is a specialization of the format method that performs a simple formatting of the specified double number. |
java.lang.StringBuffer |
format(double number,
java.lang.StringBuffer dest,
java.text.FieldPosition fieldPos)
This method formats the specified double and appends it to
a StringBuffer. |
java.lang.String |
format(long number)
This method is a specialization of the format method that performs a simple formatting of the specified long number. |
java.lang.StringBuffer |
format(long number,
java.lang.StringBuffer dest,
java.text.FieldPosition fieldPos)
This method formats the specified long and appends it to
a StringBuffer. |
java.lang.StringBuffer |
format(java.lang.Object obj,
java.lang.StringBuffer sbuf,
java.text.FieldPosition pos)
|
java.text.AttributedCharacterIterator |
formatToCharacterIterator(java.lang.Object value)
|
static java.util.Locale[] |
getAvailableLocales()
This method returns a list of locales for which concrete instances of NumberFormat subclasses may be created. |
java.util.Currency |
getCurrency()
Returns the currency corresponding to the currency symbol stored in the instance of DecimalFormatSymbols used by this
DecimalFormat. |
static org.dhmp.util.NumberFormat |
getCurrencyInstance()
This method returns an instance of NumberFormat suitable
for formatting and parsing currency values in the default locale. |
static org.dhmp.util.NumberFormat |
getCurrencyInstance(java.util.Locale loc)
This method returns an instance of NumberFormat suitable
for formatting and parsing currency values in the specified locale. |
java.text.DecimalFormatSymbols |
getDecimalFormatSymbols()
Returns a copy of the symbols used by this instance. |
int |
getGroupingSize()
|
static org.dhmp.util.NumberFormat |
getInstance()
This method returns a default instance for the default locale. |
static org.dhmp.util.NumberFormat |
getInstance(java.util.Locale loc)
This method returns a default instance for the specified locale. |
static org.dhmp.util.NumberFormat |
getIntegerInstance()
This method returns an integer formatting and parsing class for the default locale. |
static org.dhmp.util.NumberFormat |
getIntegerInstance(java.util.Locale locale)
This method returns an integer formatting and parsing class for the default locale. |
int |
getMaximumFractionDigits()
This method returns the maximum number of digits allowed in the fraction portion of a number. |
int |
getMaximumIntegerDigits()
This method returns the maximum number of digits allowed in the integer portion of a number. |
int |
getMinimumFractionDigits()
This method returns the minimum number of digits allowed in the fraction portion of a number. |
int |
getMinimumIntegerDigits()
This method returns the minimum number of digits allowed in the integer portion of a number. |
int |
getMultiplier()
|
java.lang.String |
getNegativePrefix()
|
java.lang.String |
getNegativeSuffix()
|
static org.dhmp.util.NumberFormat |
getNumberInstance()
This method returns a default instance for the specified locale. |
static org.dhmp.util.NumberFormat |
getNumberInstance(java.util.Locale loc)
This method returns a general purpose number formatting and parsing class for the default locale. |
static org.dhmp.util.NumberFormat |
getPercentInstance()
This method returns an instance of NumberFormat suitable
for formatting and parsing percentage values in the default locale. |
static org.dhmp.util.NumberFormat |
getPercentInstance(java.util.Locale loc)
This method returns an instance of NumberFormat suitable
for formatting and parsing percentage values in the specified locale. |
java.lang.String |
getPositivePrefix()
|
java.lang.String |
getPositiveSuffix()
|
int |
hashCode()
Returns a hash code for this object. |
boolean |
isDecimalSeparatorAlwaysShown()
|
boolean |
isGroupingUsed()
This method tests whether or not grouping is in use. |
boolean |
isParseIntegerOnly()
This method tests whether or not only integer values should be parsed. |
java.lang.Number |
parse(java.lang.String sourceStr)
This method parses the specified string into a Number. |
java.lang.Number |
parse(java.lang.String str,
java.text.ParsePosition pos)
This method parses the specified string into a Number. |
java.lang.Object |
parseObject(java.lang.String sourceStr,
java.text.ParsePosition pos)
This method parses the specified string into an Object. |
void |
setCurrency(java.util.Currency currency)
Sets the Currency on the
DecimalFormatSymbols used, which also sets the
currency symbols on those symbols. |
void |
setDecimalFormatSymbols(java.text.DecimalFormatSymbols newSymbols)
Sets the symbols used by this instance. |
void |
setDecimalSeparatorAlwaysShown(boolean newValue)
|
void |
setGroupingSize(int groupSize)
|
void |
setGroupingUsed(boolean newValue)
This method sets the grouping behavior of this formatter. |
void |
setMaximumFractionDigits(int newValue)
This method sets the maximum number of digits allowed in the fraction portion of a number to the specified value. |
void |
setMaximumIntegerDigits(int newValue)
This method sets the maximum number of digits allowed in the integer portion of a number to the specified value. |
void |
setMinimumFractionDigits(int newValue)
This method sets the minimum number of digits allowed in the fraction portion of a number to the specified value. |
void |
setMinimumIntegerDigits(int newValue)
This method sets the minimum number of digits allowed in the integer portion of a number to the specified value. |
void |
setMultiplier(int newValue)
|
void |
setNegativePrefix(java.lang.String newValue)
|
void |
setNegativeSuffix(java.lang.String newValue)
|
void |
setParseBigDecimal(boolean isBigDecimal)
|
void |
setParseIntegerOnly(boolean value)
This method sets the parsing behavior of this object to parse only integers or not. |
void |
setPositivePrefix(java.lang.String newValue)
|
void |
setPositiveSuffix(java.lang.String newValue)
|
java.lang.String |
toLocalizedPattern()
|
java.lang.String |
toPattern()
|
| Methods inherited from class java.text.Format |
format, parseObject |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int INTEGER_FIELD
FieldPosition object
that will return the integer portion of a formatted number.
public static final int FRACTION_FIELD
FieldPosition object
that will return the fractional portion of a formatted number.
| Constructor Detail |
public DecimalFormat()
DecimalFormat which uses the default
pattern and symbols.
public DecimalFormat(java.lang.String pattern)
DecimalFormat which uses the given
pattern and the default symbols for formatting and parsing.
pattern - the non-localized pattern to use.
java.lang.NullPointerException - if any argument is null.
java.lang.IllegalArgumentException - if the pattern is invalid.
public DecimalFormat(java.lang.String pattern,
java.text.DecimalFormatSymbols symbols)
DecimalFormat using the given pattern
and formatting symbols. This construction method is used to give
complete control over the formatting process.
pattern - the non-localized pattern to use.symbols - the set of symbols used for parsing and formatting.
java.lang.NullPointerException - if any argument is null.
java.lang.IllegalArgumentException - if the pattern is invalid.| Method Detail |
public void setParseBigDecimal(boolean isBigDecimal)
public void applyLocalizedPattern(java.lang.String pattern)
public void applyPattern(java.lang.String pattern)
public java.lang.Object clone()
public boolean equals(java.lang.Object obj)
true if:
obj is not null;obj is an instance of DecimalFormat;obj have the same attributes;
obj - the object (null permitted).
public java.lang.StringBuffer format(double number,
java.lang.StringBuffer dest,
java.text.FieldPosition fieldPos)
org.dhmp.util.NumberFormatdouble and appends it to
a StringBuffer.
number - The double to format.dest - The StringBuffer to append the formatted number
to.fieldPos - The desired FieldPosition.
StringBuffer with the appended number.public java.text.AttributedCharacterIterator formatToCharacterIterator(java.lang.Object value)
public java.lang.StringBuffer format(long number,
java.lang.StringBuffer dest,
java.text.FieldPosition fieldPos)
org.dhmp.util.NumberFormatlong and appends it to
a StringBuffer.
number - The long to format.dest - The StringBuffer to append the formatted number
to.fieldPos - The desired FieldPosition.
StringBuffer with the appended number.public java.util.Currency getCurrency()
DecimalFormatSymbols used by this
DecimalFormat.
Currency if
the currency code matches a known one, null otherwise.public java.text.DecimalFormatSymbols getDecimalFormatSymbols()
public int getGroupingSize()
public int getMultiplier()
public java.lang.String getNegativePrefix()
public java.lang.String getNegativeSuffix()
public java.lang.String getPositivePrefix()
public java.lang.String getPositiveSuffix()
public int hashCode()
public boolean isDecimalSeparatorAlwaysShown()
public java.lang.Number parse(java.lang.String str,
java.text.ParsePosition pos)
org.dhmp.util.NumberFormatNumber. This
will be a Long if possible, otherwise it will be a
Double. If no number can be parsed, no exception is
thrown. Instead, the parse position remains at its initial index.
str - The string to parse.pos - The desired ParsePosition.
Numberpublic void setCurrency(java.util.Currency currency)
Currency on the
DecimalFormatSymbols used, which also sets the
currency symbols on those symbols.
currency - The new currency to be used by this number format.public void setDecimalFormatSymbols(java.text.DecimalFormatSymbols newSymbols)
newSymbols - the symbols (null not permitted).public void setDecimalSeparatorAlwaysShown(boolean newValue)
public void setGroupingSize(int groupSize)
public void setMaximumFractionDigits(int newValue)
org.dhmp.util.NumberFormat
newValue - The new maximum fraction digits value.public void setMaximumIntegerDigits(int newValue)
org.dhmp.util.NumberFormat
newValue - The new maximum integer digits value.public void setMinimumFractionDigits(int newValue)
org.dhmp.util.NumberFormat
newValue - The new minimum fraction digits value.public void setMinimumIntegerDigits(int newValue)
org.dhmp.util.NumberFormat
newValue - The new minimum integer digits value.public void setMultiplier(int newValue)
public void setNegativePrefix(java.lang.String newValue)
public void setNegativeSuffix(java.lang.String newValue)
public void setPositivePrefix(java.lang.String newValue)
public void setPositiveSuffix(java.lang.String newValue)
public java.lang.String toLocalizedPattern()
public java.lang.String toPattern()
public final java.lang.String format(long number)
long number.
number - The long to format.
public final java.lang.StringBuffer format(java.lang.Object obj,
java.lang.StringBuffer sbuf,
java.text.FieldPosition pos)
public static java.util.Locale[] getAvailableLocales()
NumberFormat subclasses may be created.
public static final org.dhmp.util.NumberFormat getCurrencyInstance()
NumberFormat suitable
for formatting and parsing currency values in the default locale.
NumberFormat for handling currencies.public static org.dhmp.util.NumberFormat getCurrencyInstance(java.util.Locale loc)
NumberFormat suitable
for formatting and parsing currency values in the specified locale.
NumberFormat for handling currencies.public static final org.dhmp.util.NumberFormat getInstance()
NumberFormat, but the
actual class returned is dependent on the locale.
NumberFormat class.public static org.dhmp.util.NumberFormat getInstance(java.util.Locale loc)
NumberFormat, but the
actual class returned is dependent on the locale.
loc - The desired locale.
NumberFormat class.public int getMaximumFractionDigits()
public int getMaximumIntegerDigits()
public int getMinimumFractionDigits()
public int getMinimumIntegerDigits()
public static final org.dhmp.util.NumberFormat getNumberInstance()
NumberFormat, but the
actual class returned is dependent on the locale.
NumberFormat class.public static org.dhmp.util.NumberFormat getNumberInstance(java.util.Locale loc)
NumberFormat, but the actual class returned is dependent
on the locale.
public static final org.dhmp.util.NumberFormat getIntegerInstance()
NumberFormat,
but the actual class returned is dependent on the locale.
public static org.dhmp.util.NumberFormat getIntegerInstance(java.util.Locale locale)
NumberFormat,
but the actual class returned is dependent on the locale.
locale - the desired locale.
public static final org.dhmp.util.NumberFormat getPercentInstance()
NumberFormat suitable
for formatting and parsing percentage values in the default locale.
NumberFormat for handling percentages.public static org.dhmp.util.NumberFormat getPercentInstance(java.util.Locale loc)
NumberFormat suitable
for formatting and parsing percentage values in the specified locale.
loc - The desired locale.
NumberFormat for handling percentages.public boolean isGroupingUsed()
true if grouping is enabled,
false otherwise.public boolean isParseIntegerOnly()
true if only integers are parsed,
false otherwise.
public java.lang.Number parse(java.lang.String sourceStr)
throws java.text.ParseException
Number. This
will be a Long if possible, otherwise it will be a
Double. If no number can be parsed, an exception will be
thrown.
sourceStr - The string to parse.
Number
java.text.ParseException - If no number can be parsed.
public final java.lang.Object parseObject(java.lang.String sourceStr,
java.text.ParsePosition pos)
Object. This
will be a Long if possible, otherwise it will be a
Double. If no number can be parsed, no exception is
thrown. Instead, the parse position remains at its initial index.
sourceStr - The string to parse.pos - The desired ParsePosition.
Objectpublic void setGroupingUsed(boolean newValue)
newValue - true to enable grouping,
false to disable it.public void setParseIntegerOnly(boolean value)
value - true to parse only integers,
false otherwise.public final java.lang.String format(double number)
double number.
number - The double to format.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||