API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.text. NumberFormat View Source
Author(s)
Mark Davis
Helena Shih
Since
Version
1.74, 11/17/05
Serial
Hierarchy
 Object
      Format
          NumberFormat
Implements
Subclasses
Description
publicabstract abstract class NumberFormat
  NumberFormat is the abstract base class for all number formats.
See also:    DecimalFormat ChoiceFormat
Constructors
protected NumberFormat ()
  Sole constructor.
Methods
Hide/Show inherited methods
public Object clone () [Overrides Format]
Overrides Cloneable
pack-private AttributedCharacterIterator createAttributedCharacterIterator (AttributedCharacterIterator iterators) [Inherited From Format]
  Creates an AttributedCharacterIterator containg the concatenated contents of the passed in AttributedCharacterIterators.
pack-private AttributedCharacterIterator createAttributedCharacterIterator (AttributedCharacterIterator iterator, Attribute key, Object value) [Inherited From Format]
  Creates an AttributedCharacterIterator with the contents of iterator and the additional attribute key value.
pack-private AttributedCharacterIterator createAttributedCharacterIterator (String s) [Inherited From Format]
  Creates an AttributedCharacterIterator for the String s.
pack-private AttributedCharacterIterator createAttributedCharacterIterator (String string, Attribute key, Object value) [Inherited From Format]
  Returns an AttributedCharacterIterator with the String string and additional key/value pair key, value.
public boolean equals (Object obj)
Overrides equals
publicfinal String format (double number)
  Specialization of format.
publicabstract StringBuffer format (double number, StringBuffer toAppendTo, FieldPosition pos)
  Specialization of format.
publicfinal String format (long number)
  Specialization of format.
publicabstract StringBuffer format (long number, StringBuffer toAppendTo, FieldPosition pos)
  Specialization of format.
publicfinal String format (Object obj) [Inherited From Format]
  Formats an object to produce a string.
public StringBuffer format (Object number, StringBuffer toAppendTo, FieldPosition pos) [Specified in Format]
  Formats a number and appends the resulting text to the given string buffer.
public AttributedCharacterIterator formatToCharacterIterator (Object obj) [Inherited From Format]
  Formats an Object producing an AttributedCharacterIterator.
publicstatic Locale getAvailableLocales ()
  Returns an array of all locales for which the get*Instance methods of this class can return localized instances.
public Currency getCurrency ()
  Gets the currency used by this number format when formatting currency values.
publicfinalstatic NumberFormat getCurrencyInstance ()
Returns a currency format for the current default locale.
publicstatic NumberFormat getCurrencyInstance (Locale inLocale)
Returns a currency format for the specified locale.
publicfinalstatic NumberFormat getInstance ()
  Returns a general-purpose number format for the current default locale.
publicstatic NumberFormat getInstance (Locale inLocale)
  Returns a general-purpose number format for the specified locale.
publicfinalstatic NumberFormat getIntegerInstance ()
  Returns an integer number format for the current default locale.
publicstatic NumberFormat getIntegerInstance (Locale inLocale)
  Returns an integer number format for the specified locale.
public int getMaximumFractionDigits ()
  Returns the maximum number of digits allowed in the fraction portion of a number.
public int getMaximumIntegerDigits ()
  Returns the maximum number of digits allowed in the integer portion of a number.
public int getMinimumFractionDigits ()
  Returns the minimum number of digits allowed in the fraction portion of a number.
public int getMinimumIntegerDigits ()
  Returns the minimum number of digits allowed in the integer portion of a number.
publicfinalstatic NumberFormat getNumberInstance ()
Returns a general-purpose number format for the current default locale.
publicstatic NumberFormat getNumberInstance (Locale inLocale)
Returns a general-purpose number format for the specified locale.
publicfinalstatic NumberFormat getPercentInstance ()
Returns a percentage format for the current default locale.
publicstatic NumberFormat getPercentInstance (Locale inLocale)
Returns a percentage format for the specified locale.
public RoundingMode getRoundingMode ()
  Gets the RoundingMode used in this NumberFormat.
pack-privatefinalstatic NumberFormat getScientificInstance ()
Returns a scientific format for the current default locale.
pack-privatestatic NumberFormat getScientificInstance (Locale inLocale)
Returns a scientific format for the specified locale.
public int hashCode ()
Overrides hashCode
public boolean isGroupingUsed ()
  Returns true if grouping is used in this format.
public boolean isParseIntegerOnly ()
  Returns true if this format will parse numbers as integers only.
public Number parse (String source) throws ParseException
  Parses text from the beginning of the given string to produce a number.
publicabstract Number parse (String source, ParsePosition parsePosition)
  Returns a Long if possible (e.g., within the range [Long.MIN_VALUE, Long.MAX_VALUE] and with no decimals), otherwise a Double.
public Object parseObject (String source) throws ParseException [Inherited From Format]
  Parses text from the beginning of the given string to produce an object.
publicfinal Object parseObject (String source, ParsePosition pos) [Specified in Format]
  Parses text from a string to produce a Number.
public void setCurrency (Currency currency)
  Sets the currency used by this number format when formatting currency values.
public void setGroupingUsed (boolean newValue)
  Set whether or not grouping will be used in this format.
public void setMaximumFractionDigits (int newValue)
  Sets the maximum number of digits allowed in the fraction portion of a number.
public void setMaximumIntegerDigits (int newValue)
  Sets the maximum number of digits allowed in the integer portion of a number.
public void setMinimumFractionDigits (int newValue)
  Sets the minimum number of digits allowed in the fraction portion of a number.
public void setMinimumIntegerDigits (int newValue)
  Sets the minimum number of digits allowed in the integer portion of a number.
public void setParseIntegerOnly (boolean value)
  Sets whether or not numbers should be parsed as integers only.
public void setRoundingMode (RoundingMode roundingMode)
  Sets the RoundingMode used in this NumberFormat.
Fields
Hide/Show inherited fields
pack-privatefinalstatic int currentSerialVersion = "1"
publicfinalstatic int FRACTION_FIELD = "1"
  Field constant used to construct a FieldPosition object.
publicfinalstatic int INTEGER_FIELD = "0"
  Field constant used to construct a FieldPosition object.
pack-privatefinalstatic long serialVersionUID = "-2308460125733713944"
Nested Classes
  NumberFormat.Field
Defines constants that are used as attribute keys in the AttributedCharacterIterator returned from NumberFormat.formatToCharacterIterator and as field identifiers in FieldPosition.
  Format.Field
Defines constants that are used as attribute keys in the AttributedCharacterIterator returned from Format.formatToCharacterIterator and as field identifiers in FieldPosition.
  Format.FieldDelegate
FieldDelegate is notified by the various Format implementations as they are formatting the Objects.
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar