Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.text
Class DecimalFormatSymbols  view DecimalFormatSymbols download DecimalFormatSymbols.java

java.lang.Object
  extended byjava.text.DecimalFormatSymbols
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public final class DecimalFormatSymbols
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

This class is a container for the symbols used by DecimalFormat to format numbers and currency for a particular locale. These are normally handled automatically, but an application can override values as desired using this class.


Field Summary
private  java.util.Currency currency
          The currency used for the symbols in this instance.
private  java.lang.String currencySymbol
           
private  char decimalSeparator
           
private  char digit
           
private  char exponential
           
private  char groupingSeparator
           
private  java.lang.String infinity
           
private  java.lang.String intlCurrencySymbol
           
private  java.util.Locale locale
           
private  char minusSign
           
private  char monetarySeparator
           
private  java.lang.String NaN
           
private  char patternSeparator
           
private  char percent
           
private  char perMill
           
private  int serialVersionOnStream
           
private static long serialVersionUID
           
private  char zeroDigit
           
 
Constructor Summary
DecimalFormatSymbols()
          This method initializes a new instance of DecimalFormatSymbols for the default locale.
DecimalFormatSymbols(java.util.Locale loc)
          This method initializes a new instance of DecimalFormatSymbols for the specified locale.
 
Method Summary
 java.lang.Object clone()
          This method may be called to create a new copy of the Object.
 boolean equals(java.lang.Object obj)
          This method this this object for equality against the specified object.
 java.util.Currency getCurrency()
          Returns the currency corresponding to the currency symbol stored in this instance of DecimalFormatSymbols.
 java.lang.String getCurrencySymbol()
          This method returns the currency symbol in local format.
 char getDecimalSeparator()
          This method returns the character used as the decimal point.
 char getDigit()
          This method returns the character used to represent a digit in a format pattern string.
(package private)  char getExponential()
          This method returns the character used to represent the exponential format.
 char getGroupingSeparator()
          This method sets the character used to separate groups of digits.
 java.lang.String getInfinity()
          This method returns the character used to represent infinity.
 java.lang.String getInternationalCurrencySymbol()
          This method returns the ISO 4217 currency code for the currency used.
 char getMinusSign()
          This method returns the character used to represent the minus sign.
 char getMonetaryDecimalSeparator()
          This method returns the character used to represent the decimal point for currency values.
 java.lang.String getNaN()
          This method returns the string used to represent the NaN (not a number) value.
 char getPatternSeparator()
          This method returns the character used to separate positive and negative subpatterns in a format pattern.
 char getPercent()
          This method returns the character used as the percent sign.
 char getPerMill()
          This method returns the character used as the per mille character.
 char getZeroDigit()
          This method returns the character used to represent the digit zero.
 int hashCode()
          This method returns a hash value for this object.
private  void readObject(java.io.ObjectInputStream stream)
           
private  char safeGetChar(java.util.ResourceBundle bundle, java.lang.String name, char def)
           
private  java.lang.String safeGetString(java.util.ResourceBundle bundle, java.lang.String name, java.lang.String def)
          Retrieves a valid string, either using the supplied resource bundle or the default value.
 void setCurrency(java.util.Currency currency)
          This method sets the currency symbol and ISO 4217 currency code to the values obtained from the supplied currency.
 void setCurrencySymbol(java.lang.String currency)
          This method sets the currency symbol to the specified value.
 void setDecimalSeparator(char decimalSep)
          This method sets the decimal point character to the specified value.
 void setDigit(char digit)
          This method sets the character used to represents a digit in a format string to the specified value.
(package private)  void setExponential(char exp)
          This method sets the exponential character used in the format string to the specified value.
 void setGroupingSeparator(char groupSep)
          This method sets the character used to separate groups of digits.
 void setInfinity(java.lang.String infinity)
          This method sets the string used to represents infinity.
 void setInternationalCurrencySymbol(java.lang.String currencyCode)
          This method sets the international currency symbol to the specified value.
 void setMinusSign(char minusSign)
          This method sets the character used to represent the minus sign.
 void setMonetaryDecimalSeparator(char decimalSep)
          This method sets the character used for the decimal point in currency values.
 void setNaN(java.lang.String nan)
          This method sets the string used to represent the NaN (not a number) value.
 void setPatternSeparator(char patternSep)
          This method sets the character used to separate positive and negative subpatterns in a format pattern.
 void setPercent(char percent)
          This method sets the character used as the percent sign.
 void setPerMill(char perMill)
          This method sets the character used as the per mille character.
 void setZeroDigit(char zeroDigit)
          This method sets the character used to represent the digit zero.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currencySymbol

private java.lang.String currencySymbol

decimalSeparator

private char decimalSeparator

digit

private char digit

exponential

private char exponential

groupingSeparator

private char groupingSeparator

infinity

private java.lang.String infinity

intlCurrencySymbol

private java.lang.String intlCurrencySymbol

minusSign

private char minusSign

monetarySeparator

private char monetarySeparator

NaN

private java.lang.String NaN

patternSeparator

private char patternSeparator

percent

private char percent

perMill

private char perMill

serialVersionOnStream

private int serialVersionOnStream

zeroDigit

private char zeroDigit

locale

private java.util.Locale locale

currency

private transient java.util.Currency currency
The currency used for the symbols in this instance. This is stored temporarily for efficiency reasons, as well as to ensure that the correct instance is restored from the currency code.


serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

DecimalFormatSymbols

public DecimalFormatSymbols()
This method initializes a new instance of DecimalFormatSymbols for the default locale.


DecimalFormatSymbols

public DecimalFormatSymbols(java.util.Locale loc)
This method initializes a new instance of DecimalFormatSymbols for the specified locale. Note: if the locale does not have an associated Currency instance, the currency symbol and international currency symbol will be set to the strings "?" and "XXX" respectively. This generally happens with language locales (those with no specified country), such as Locale.ENGLISH.

Method Detail

clone

public java.lang.Object clone()
Description copied from class: java.lang.Object
This method may be called to create a new copy of the Object. The typical behavior is as follows:
  • o == o.clone() is false
  • o.getClass() == o.clone().getClass() is true
  • o.equals(o) is true

However, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override Object.equals(Object)>Object.equals(Object) 55 .

If the Object you call clone() on does not implement java.lang.Cloneable (which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.

Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.

All array types implement Cloneable, and override this method as follows (it should never fail):

 public Object clone()
 {
   try
     {
       super.clone();
     }
   catch (CloneNotSupportedException e)
     {
       throw new InternalError(e.getMessage());
     }
 }
 


safeGetString

private java.lang.String safeGetString(java.util.ResourceBundle bundle,
                                       java.lang.String name,
                                       java.lang.String def)
Retrieves a valid string, either using the supplied resource bundle or the default value.


safeGetChar

private char safeGetChar(java.util.ResourceBundle bundle,
                         java.lang.String name,
                         char def)

equals

public boolean equals(java.lang.Object obj)
This method this this object for equality against the specified object. This will be true if and only if the following criteria are met with regard to the specified object:

  • It is not null.
  • It is an instance of DecimalFormatSymbols.
  • All of its symbols are identical to the symbols in this object.


getCurrency

public java.util.Currency getCurrency()
Returns the currency corresponding to the currency symbol stored in this instance of DecimalFormatSymbols.


getCurrencySymbol

public java.lang.String getCurrencySymbol()
This method returns the currency symbol in local format. For example, "$" for Canadian dollars.


getDecimalSeparator

public char getDecimalSeparator()
This method returns the character used as the decimal point.


getDigit

public char getDigit()
This method returns the character used to represent a digit in a format pattern string.


getExponential

char getExponential()
This method returns the character used to represent the exponential format. This is a GNU Classpath extension.


getGroupingSeparator

public char getGroupingSeparator()
This method sets the character used to separate groups of digits. For example, the United States uses a comma (,) to separate thousands in a number.


getInfinity

public java.lang.String getInfinity()
This method returns the character used to represent infinity.


getInternationalCurrencySymbol

public java.lang.String getInternationalCurrencySymbol()
This method returns the ISO 4217 currency code for the currency used.


getMinusSign

public char getMinusSign()
This method returns the character used to represent the minus sign.


getMonetaryDecimalSeparator

public char getMonetaryDecimalSeparator()
This method returns the character used to represent the decimal point for currency values.


getNaN

public java.lang.String getNaN()
This method returns the string used to represent the NaN (not a number) value.


getPatternSeparator

public char getPatternSeparator()
This method returns the character used to separate positive and negative subpatterns in a format pattern.


getPercent

public char getPercent()
This method returns the character used as the percent sign.


getPerMill

public char getPerMill()
This method returns the character used as the per mille character.


getZeroDigit

public char getZeroDigit()
This method returns the character used to represent the digit zero.


hashCode

public int hashCode()
This method returns a hash value for this object.


setCurrency

public void setCurrency(java.util.Currency currency)
This method sets the currency symbol and ISO 4217 currency code to the values obtained from the supplied currency.


setCurrencySymbol

public void setCurrencySymbol(java.lang.String currency)
This method sets the currency symbol to the specified value.


setDecimalSeparator

public void setDecimalSeparator(char decimalSep)
This method sets the decimal point character to the specified value.


setDigit

public void setDigit(char digit)
This method sets the character used to represents a digit in a format string to the specified value.


setExponential

void setExponential(char exp)
This method sets the exponential character used in the format string to the specified value. This is a GNU Classpath extension.


setGroupingSeparator

public void setGroupingSeparator(char groupSep)
This method sets the character used to separate groups of digits.


setInfinity

public void setInfinity(java.lang.String infinity)
This method sets the string used to represents infinity.


setInternationalCurrencySymbol

public void setInternationalCurrencySymbol(java.lang.String currencyCode)
This method sets the international currency symbol to the specified value. If a valid Currency instance exists for the international currency code, then this is used for the currency attribute, and the currency symbol is set to the corresponding value from this instance. Otherwise, the currency attribute is set to null and the symbol is left unmodified.


setMinusSign

public void setMinusSign(char minusSign)
This method sets the character used to represent the minus sign.


setMonetaryDecimalSeparator

public void setMonetaryDecimalSeparator(char decimalSep)
This method sets the character used for the decimal point in currency values.


setNaN

public void setNaN(java.lang.String nan)
This method sets the string used to represent the NaN (not a number) value.


setPatternSeparator

public void setPatternSeparator(char patternSep)
This method sets the character used to separate positive and negative subpatterns in a format pattern.


setPercent

public void setPercent(char percent)
This method sets the character used as the percent sign.


setPerMill

public void setPerMill(char perMill)
This method sets the character used as the per mille character.


setZeroDigit

public void setZeroDigit(char zeroDigit)
This method sets the character used to represent the digit zero.


readObject

private void readObject(java.io.ObjectInputStream stream)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException