| Constructor and Description |
|---|
NativeDecimalFormat(String pattern,
DecimalFormatSymbols dfs) |
NativeDecimalFormat(String pattern,
LocaleData data) |
| Modifier and Type | Method and Description |
|---|---|
void |
applyLocalizedPattern(String pattern) |
void |
applyPattern(String pattern) |
Object |
clone()
Creates and returns a copy of this
Object. |
void |
close() |
boolean |
equals(Object object)
Note: this doesn't check that the underlying native DecimalFormat objects' configured
native DecimalFormatSymbols objects are equal.
|
protected void |
finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
char[] |
formatBigDecimal(BigDecimal value,
FieldPosition field) |
char[] |
formatBigInteger(BigInteger value,
FieldPosition field) |
char[] |
formatDouble(double value,
FieldPosition field) |
char[] |
formatLong(long value,
FieldPosition field) |
AttributedCharacterIterator |
formatToCharacterIterator(Object object) |
int |
getGroupingSize() |
int |
getMaximumFractionDigits() |
int |
getMaximumIntegerDigits() |
int |
getMinimumFractionDigits() |
int |
getMinimumIntegerDigits() |
int |
getMultiplier() |
String |
getNegativePrefix() |
String |
getNegativeSuffix() |
String |
getPositivePrefix() |
String |
getPositiveSuffix() |
boolean |
isDecimalSeparatorAlwaysShown() |
boolean |
isGroupingUsed() |
boolean |
isParseBigDecimal() |
boolean |
isParseIntegerOnly() |
Number |
parse(String string,
ParsePosition position) |
void |
setCurrency(String currencySymbol,
String currencyCode) |
void |
setDecimalFormatSymbols(DecimalFormatSymbols dfs)
Copies the DecimalFormatSymbols settings into our native peer in bulk.
|
void |
setDecimalFormatSymbols(LocaleData localeData) |
void |
setDecimalSeparatorAlwaysShown(boolean value) |
void |
setGroupingSize(int value) |
void |
setGroupingUsed(boolean value) |
void |
setMaximumFractionDigits(int value) |
void |
setMaximumIntegerDigits(int value) |
void |
setMinimumFractionDigits(int value) |
void |
setMinimumIntegerDigits(int value) |
void |
setMultiplier(int value) |
void |
setNegativePrefix(String value) |
void |
setNegativeSuffix(String value) |
void |
setParseBigDecimal(boolean value) |
void |
setParseIntegerOnly(boolean value) |
void |
setPositivePrefix(String value) |
void |
setPositiveSuffix(String value) |
void |
setRoundingMode(RoundingMode roundingMode,
double roundingIncrement) |
String |
toLocalizedPattern() |
String |
toPattern() |
String |
toString()
Returns a string containing a concise, human-readable description of this
object.
|
public NativeDecimalFormat(String pattern, DecimalFormatSymbols dfs)
public NativeDecimalFormat(String pattern, LocaleData data)
public void close()
protected void finalize()
throws Throwable
ObjectNote that objects that override finalize are significantly more expensive than
objects that don't. Finalizers may be run a long time after the object is no longer
reachable, depending on memory pressure, so it's a bad idea to rely on them for cleanup.
Note also that finalizers are run on a single VM-wide finalizer thread,
so doing blocking work in a finalizer is a bad idea. A finalizer is usually only necessary
for a class that has a native peer and needs to call a native method to destroy that peer.
Even then, it's better to provide an explicit close method (and implement
Closeable), and insist that callers manually dispose of instances. This
works well for something like files, but less well for something like a BigInteger
where typical calling code would have to deal with lots of temporaries. Unfortunately,
code that creates lots of temporaries is the worst kind of code from the point of view of
the single finalizer thread.
If you must use finalizers, consider at least providing your own
ReferenceQueue and having your own thread process that queue.
Unlike constructors, finalizers are not automatically chained. You are responsible for
calling super.finalize() yourself.
Uncaught exceptions thrown by finalizers are ignored and do not terminate the finalizer thread. See Effective Java Item 7, "Avoid finalizers" for more.
public Object clone()
ObjectObject. The default
implementation returns a so-called "shallow" copy: It creates a new
instance of the same class and then copies the field values (including
object references) from this instance to the new instance. A "deep" copy,
in contrast, would also recursively clone nested objects. A subclass that
needs to implement this kind of cloning should call super.clone()
to create the new instance and then create deep copies of the nested,
mutable objects.public boolean equals(Object object)
equals in class Objectobject - the object to compare this instance with.true if the specified object is equal to this Object; false otherwise.Object.hashCode()public String toString()
ObjectgetClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toString method
if you intend implementing your own toString method.
public void setDecimalFormatSymbols(DecimalFormatSymbols dfs)
public void setDecimalFormatSymbols(LocaleData localeData)
public char[] formatBigDecimal(BigDecimal value, FieldPosition field)
public char[] formatBigInteger(BigInteger value, FieldPosition field)
public char[] formatLong(long value,
FieldPosition field)
public char[] formatDouble(double value,
FieldPosition field)
public void applyLocalizedPattern(String pattern)
public void applyPattern(String pattern)
public AttributedCharacterIterator formatToCharacterIterator(Object object)
public String toLocalizedPattern()
public String toPattern()
public Number parse(String string, ParsePosition position)
public int getMaximumFractionDigits()
public int getMaximumIntegerDigits()
public int getMinimumFractionDigits()
public int getMinimumIntegerDigits()
public int getGroupingSize()
public int getMultiplier()
public String getNegativePrefix()
public String getNegativeSuffix()
public String getPositivePrefix()
public String getPositiveSuffix()
public boolean isDecimalSeparatorAlwaysShown()
public boolean isParseBigDecimal()
public boolean isParseIntegerOnly()
public boolean isGroupingUsed()
public void setDecimalSeparatorAlwaysShown(boolean value)
public void setGroupingSize(int value)
public void setGroupingUsed(boolean value)
public void setMaximumFractionDigits(int value)
public void setMaximumIntegerDigits(int value)
public void setMinimumFractionDigits(int value)
public void setMinimumIntegerDigits(int value)
public void setMultiplier(int value)
public void setNegativePrefix(String value)
public void setNegativeSuffix(String value)
public void setPositivePrefix(String value)
public void setPositiveSuffix(String value)
public void setParseBigDecimal(boolean value)
public void setParseIntegerOnly(boolean value)
public void setRoundingMode(RoundingMode roundingMode, double roundingIncrement)