public abstract class NumberFormat extends Format implements Cloneable
Format.Field
Modifier and Type | Field and Description |
---|---|
static int |
FRACTION_FIELD |
static int |
INTEGER_FIELD |
Constructor and Description |
---|
NumberFormat() |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Returns a copy of this
Format instance. |
boolean |
equals(Object obj)
Default object equality (is identity).
|
String |
format(double number) |
abstract StringBuffer |
format(double number,
StringBuffer buf,
FieldPosition pos) |
String |
format(long number) |
abstract StringBuffer |
format(long number,
StringBuffer buf,
FieldPosition pos) |
StringBuffer |
format(Object number,
StringBuffer buf,
FieldPosition pos)
Appends the specified object to the specified string buffer using the
rules of this format.
|
static Locale[] |
getAvailableLocales() |
static NumberFormat |
getCurrencyInstance() |
static NumberFormat |
getCurrencyInstance(Locale loc) |
static NumberFormat |
getInstance() |
static NumberFormat |
getInstance(Locale loc) |
int |
getMaximumFractionDigits() |
int |
getMaximumIntegerDigits() |
int |
getMinimumFractionDigits() |
int |
getMinimumIntegerDigits() |
static NumberFormat |
getNumberInstance() |
static NumberFormat |
getNumberInstance(Locale loc) |
static NumberFormat |
getPercentInstance() |
static NumberFormat |
getPercentInstance(Locale loc) |
int |
hashCode()
The (default) object hashcode: for transient objects this is simply the
address of the instance in memory, for persistent objects it is the
address at which the instance was first created (maybe in a previous
activation of the VM).
|
boolean |
isGroupingUsed() |
boolean |
isParseIntegerOnly() |
Number |
parse(String s) |
abstract Number |
parse(String s,
ParsePosition pos) |
Object |
parseObject(String srcStr,
ParsePosition pos)
Parses the specified string starting at the index specified by
position . |
void |
setGroupingUsed(boolean use) |
void |
setMaximumFractionDigits(int val) |
void |
setMaximumIntegerDigits(int val) |
void |
setMinimumFractionDigits(int val) |
void |
setMinimumIntegerDigits(int val) |
void |
setParseIntegerOnly(boolean only) |
format, formatToCharacterIterator, parseObject
public static final int FRACTION_FIELD
public static final int INTEGER_FIELD
public static Locale[] getAvailableLocales()
public static final NumberFormat getCurrencyInstance()
public static NumberFormat getCurrencyInstance(Locale loc)
public static final NumberFormat getInstance()
public static NumberFormat getInstance(Locale loc)
public static final NumberFormat getNumberInstance()
public static NumberFormat getNumberInstance(Locale loc)
public static final NumberFormat getPercentInstance()
public static NumberFormat getPercentInstance(Locale loc)
public abstract StringBuffer format(double number, StringBuffer buf, FieldPosition pos)
public abstract StringBuffer format(long number, StringBuffer buf, FieldPosition pos)
public abstract Number parse(String s, ParsePosition pos)
public Object clone()
Format
Format
instance.public boolean equals(Object obj)
Object
public final String format(double number)
public final String format(long number)
public final StringBuffer format(Object number, StringBuffer buf, FieldPosition pos)
Format
field
is an input/output parameter. If its field
member contains an enum value specifying a field on input, then its
beginIndex
and endIndex
members will be updated with the
text offset of the first occurrence of this field in the formatted text.
public int getMaximumFractionDigits()
public int getMaximumIntegerDigits()
public int getMinimumFractionDigits()
public int getMinimumIntegerDigits()
public int hashCode()
Object
public boolean isGroupingUsed()
public boolean isParseIntegerOnly()
public Number parse(String s) throws ParseException
ParseException
public final Object parseObject(String srcStr, ParsePosition pos)
Format
position
. If the string is successfully parsed then the index of
the ParsePosition
is updated to the index following the parsed
text. On error, the index is unchanged and the error index of
ParsePosition
is set to the index where the error occurred.parseObject
in class Format
null
if there is
an error.public void setGroupingUsed(boolean use)
public void setParseIntegerOnly(boolean only)
public void setMaximumFractionDigits(int val)
public void setMaximumIntegerDigits(int val)
public void setMinimumFractionDigits(int val)
public void setMinimumIntegerDigits(int val)