Methods Summary |
---|
public java.lang.Object | clone()Returns a new {@code DecimalFormatSymbols} with the same symbols as this
{@code DecimalFormatSymbols}.
try {
DecimalFormatSymbols symbols = (DecimalFormatSymbols) super.clone();
symbols.patternChars = patternChars.clone();
return symbols;
} catch (CloneNotSupportedException e) {
return null;
}
|
public boolean | equals(java.lang.Object object)Compares the specified object to this {@code DecimalFormatSymbols} and
indicates if they are equal. In order to be equal, {@code object} must be
an instance of {@code DecimalFormatSymbols} and contain the same symbols.
if (this == object) {
return true;
}
if (!(object instanceof DecimalFormatSymbols)) {
return false;
}
DecimalFormatSymbols obj = (DecimalFormatSymbols) object;
return Arrays.equals(patternChars, obj.patternChars)
&& infinity.equals(obj.infinity) && NaN.equals(obj.NaN)
&& currencySymbol.equals(obj.currencySymbol)
&& intlCurrencySymbol.equals(obj.intlCurrencySymbol);
|
public java.util.Currency | getCurrency()Returns the currency.
{@code null} is returned if {@code setInternationalCurrencySymbol()} has
been previously called with a value that is not a valid ISO 4217 currency
code.
return currency;
|
public java.lang.String | getCurrencySymbol()Returns the currency symbol.
return currencySymbol;
|
public char | getDecimalSeparator()Returns the character which represents the decimal point in a number.
return patternChars[DecimalSeparator];
|
public char | getDigit()Returns the character which represents a single digit in a format
pattern.
return patternChars[Digit];
|
char | getExponential()
return patternChars[Exponent];
|
public char | getGroupingSeparator()Returns the character used as the thousands separator in a number.
return patternChars[GroupingSeparator];
|
public java.lang.String | getInfinity()Returns the string which represents infinity.
return infinity;
|
public java.lang.String | getInternationalCurrencySymbol()Returns the international currency symbol.
return intlCurrencySymbol;
|
public char | getMinusSign()Returns the minus sign character.
return patternChars[MinusSign];
|
public char | getMonetaryDecimalSeparator()Returns the character which represents the decimal point in a monetary
value.
return patternChars[MonetaryDecimalSeparator];
|
public java.lang.String | getNaN()Returns the string which represents NaN.
return NaN;
|
public char | getPatternSeparator()Returns the character which separates the positive and negative patterns
in a format pattern.
return patternChars[PatternSeparator];
|
public char | getPerMill()Returns the per mill sign character.
return patternChars[PerMill];
|
public char | getPercent()Returns the percent character.
return patternChars[Percent];
|
public char | getZeroDigit()Returns the character which represents zero.
return patternChars[ZeroDigit];
|
public int | hashCode()
return new String(patternChars).hashCode() + infinity.hashCode()
+ NaN.hashCode() + currencySymbol.hashCode()
+ intlCurrencySymbol.hashCode();
|
private void | readObject(java.io.ObjectInputStream stream)
ObjectInputStream.GetField fields = stream.readFields();
patternChars = new char[10];
currencySymbol = (String) fields.get("currencySymbol", ""); //$NON-NLS-1$ //$NON-NLS-2$
setDecimalSeparator(fields.get("decimalSeparator", '.")); //$NON-NLS-1$
setDigit(fields.get("digit", '#")); //$NON-NLS-1$
setGroupingSeparator(fields.get("groupingSeparator", ',")); //$NON-NLS-1$
infinity = (String) fields.get("infinity", ""); //$NON-NLS-1$ //$NON-NLS-2$
intlCurrencySymbol = (String) fields.get("intlCurrencySymbol", ""); //$NON-NLS-1$ //$NON-NLS-2$
setMinusSign(fields.get("minusSign", '-")); //$NON-NLS-1$
NaN = (String) fields.get("NaN", ""); //$NON-NLS-1$ //$NON-NLS-2$
setPatternSeparator(fields.get("patternSeparator", ';")); //$NON-NLS-1$
setPercent(fields.get("percent", '%")); //$NON-NLS-1$
setPerMill(fields.get("perMill", '\u2030")); //$NON-NLS-1$
setZeroDigit(fields.get("zeroDigit", '0")); //$NON-NLS-1$
locale = (Locale) fields.get("locale", null); //$NON-NLS-1$
if (fields.get("serialVersionOnStream", 0) == 0) { //$NON-NLS-1$
setMonetaryDecimalSeparator(getDecimalSeparator());
setExponential('E");
} else {
setMonetaryDecimalSeparator(fields.get("monetarySeparator", '.")); //$NON-NLS-1$
setExponential(fields.get("exponential", 'E")); //$NON-NLS-1$
}
try {
currency = Currency.getInstance(intlCurrencySymbol);
} catch (IllegalArgumentException e) {
currency = null;
}
|
public void | setCurrency(java.util.Currency currency)Sets the currency.
The international currency symbol and the currency symbol are updated,
but the min and max number of fraction digits stays the same.
if (currency == null) {
throw new NullPointerException();
}
if (currency == this.currency) {
return;
}
this.currency = currency;
intlCurrencySymbol = currency.getCurrencyCode();
currencySymbol = currency.getSymbol(locale);
|
public void | setCurrencySymbol(java.lang.String value)Sets the currency symbol.
currencySymbol = value;
|
public void | setDecimalSeparator(char value)Sets the character which represents the decimal point in a number.
patternChars[DecimalSeparator] = value;
|
public void | setDigit(char value)Sets the character which represents a single digit in a format pattern.
patternChars[Digit] = value;
|
void | setExponential(char value)
patternChars[Exponent] = value;
|
public void | setGroupingSeparator(char value)Sets the character used as the thousands separator in a number.
patternChars[GroupingSeparator] = value;
|
public void | setInfinity(java.lang.String value)Sets the string which represents infinity.
infinity = value;
|
public void | setInternationalCurrencySymbol(java.lang.String value)Sets the international currency symbol.
The currency and currency symbol are also updated if {@code value} is a
valid ISO4217 currency code.
The min and max number of fraction digits stay the same.
if (value == null) {
currency = null;
intlCurrencySymbol = null;
return;
}
if (value.equals(intlCurrencySymbol)) {
return;
}
try {
currency = Currency.getInstance(value);
currencySymbol = currency.getSymbol(locale);
} catch (IllegalArgumentException e) {
currency = null;
}
intlCurrencySymbol = value;
|
public void | setMinusSign(char value)Sets the minus sign character.
patternChars[MinusSign] = value;
|
public void | setMonetaryDecimalSeparator(char value)Sets the character which represents the decimal point in a monetary
value.
patternChars[MonetaryDecimalSeparator] = value;
|
public void | setNaN(java.lang.String value)Sets the string which represents NaN.
NaN = value;
|
public void | setPatternSeparator(char value)Sets the character which separates the positive and negative patterns in
a format pattern.
patternChars[PatternSeparator] = value;
|
public void | setPerMill(char value)Sets the per mill sign character.
patternChars[PerMill] = value;
|
public void | setPercent(char value)Sets the percent character.
patternChars[Percent] = value;
|
public void | setZeroDigit(char value)Sets the character which represents zero.
patternChars[ZeroDigit] = value;
|
private void | writeObject(java.io.ObjectOutputStream stream) //$NON-NLS-1$
ObjectOutputStream.PutField fields = stream.putFields();
fields.put("currencySymbol", currencySymbol); //$NON-NLS-1$
fields.put("decimalSeparator", getDecimalSeparator()); //$NON-NLS-1$
fields.put("digit", getDigit()); //$NON-NLS-1$
fields.put("exponential", getExponential()); //$NON-NLS-1$
fields.put("groupingSeparator", getGroupingSeparator()); //$NON-NLS-1$
fields.put("infinity", infinity); //$NON-NLS-1$
fields.put("intlCurrencySymbol", intlCurrencySymbol); //$NON-NLS-1$
fields.put("minusSign", getMinusSign()); //$NON-NLS-1$
fields.put("monetarySeparator", getMonetaryDecimalSeparator()); //$NON-NLS-1$
fields.put("NaN", NaN); //$NON-NLS-1$
fields.put("patternSeparator", getPatternSeparator()); //$NON-NLS-1$
fields.put("percent", getPercent()); //$NON-NLS-1$
fields.put("perMill", getPerMill()); //$NON-NLS-1$
fields.put("serialVersionOnStream", 1); //$NON-NLS-1$
fields.put("zeroDigit", getZeroDigit()); //$NON-NLS-1$
fields.put("locale", locale); //$NON-NLS-1$
stream.writeFields();
|