Oracle® Globalization Development Kit Java API Reference
10g Release 1(10.1)

B10971-01

oracle.i18n.text
Class OraNumberFormat

java.lang.Object
  |
  +--java.text.Format
        |
        +--oracle.i18n.text.OraNumberFormat
All Implemented Interfaces:
Cloneable, Serializable
Direct Known Subclasses:
OraDecimalFormat

public abstract class OraNumberFormat
extends Format

OraNumberFormat is an abstract class to do locale sensitive formatting and parsing between number and string. It supports Oracle number formatting behavior.

See Also:
OraDecimalFormat, Serialized Form

Nested Class Summary

 

Nested classes inherited from class java.text.Format
Format.Field

 

Field Summary
static int ALL_FIELD
          Constant for ALL field alignment.
static int FRACTION_FIELD
          Constant for FRACTION field alignment.
static int INTEGER_FIELD
          Constant for INTEGER field alignment.

 

Constructor Summary
OraNumberFormat()
           

 

Method Summary
 Object clone()
          Overrides the cloneable.
 boolean equals(Object obj)
          Overrides the equals.
 String format(BigDecimal number)
          Formats a BigDecimal into a string.
abstract  StringBuffer format(BigDecimal number, StringBuffer toAppendTo, FieldPosition position)
          Formats a BigDecimal into a string.
 String format(BigInteger number)
          Formats a BigInteger into a string.
abstract  StringBuffer format(BigInteger number, StringBuffer toAppendTo, FieldPosition position)
          Formats a BigInteger into a string.
 String format(double number)
          Formats a double into a string.
abstract  StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition position)
          Formats a double into a string.
 String format(long number)
          Formats a long into a string.
abstract  StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition position)
          Formats a long into a string.
 StringBuffer format(Object number, StringBuffer toAppendTo, FieldPosition position)
          Formats an Object into a string.
static oracle.i18n.text.OraNumberFormat getCurrencyInstance()
          Returns a number formatter that uses the default currency format pattern for the default locale.
static oracle.i18n.text.OraNumberFormat getCurrencyInstance(Locale locale)
          Returns a number formatter that uses the default currency format pattern for the given locale.
static oracle.i18n.text.OraNumberFormat getCurrencyInstance(oracle.i18n.util.OraLocaleInfo localeInfo)
          Returns a number formatter that uses the default currency format pattern for the given OraLocaleInfo.
static String getDefaultCurrencyFormatPattern(Locale locale)
          Returns the default currency format pattern for the given locale.
static String getDefaultCurrencyFormatPattern(oracle.i18n.util.OraLocaleInfo localeInfo)
          Returns the default currency format pattern for the given OraLocaleInfo.
static String getDefaultNumberFormatPattern(Locale locale)
          Returns the default number format pattern for the given locale.
static String getDefaultNumberFormatPattern(oracle.i18n.util.OraLocaleInfo localeInfo)
          Returns the default number format pattern for the given OraLocaleInfo.
static oracle.i18n.text.OraNumberFormat getInstance()
          Returns a number formatter that uses the default number format pattern for the default locale.
static oracle.i18n.text.OraNumberFormat getInstance(Locale locale)
          Returns a number formatter that uses the default currency format pattern for the given locale.
static oracle.i18n.text.OraNumberFormat getInstance(oracle.i18n.util.OraLocaleInfo localeInfo)
          Returns a number formatter that uses the default currency format pattern for the given OraLocaleInfo.
static oracle.i18n.text.OraNumberFormat getNumberInstance()
          Returns a number formatter that uses the default number format pattern for the default locale.
static oracle.i18n.text.OraNumberFormat getNumberInstance(Locale locale)
          Returns a number formatter that uses the default currency format pattern for the given locale.
static oracle.i18n.text.OraNumberFormat getNumberInstance(oracle.i18n.util.OraLocaleInfo localeInfo)
          Returns a number formatter that uses the default currency format pattern for the given OraLocaleInfo.
 boolean isGroupingUsed()
          Checks if the grouping separator is used for this formatter.
 boolean isParseIntegerOnly()
          Checks if this formatter parses integer portion only.
 Number parse(String text)
          Parses a string into a Number.
abstract  Number parse(String text, ParsePosition parsePosition)
          Parses a string into a Number, starting from the given parse position.
 Object parseObject(String text, ParsePosition parsePosition)
          Parses a string into a (Number) Object, starting from the given parse position.
 void setGroupingUsed(boolean val)
          Sets the switch for grouping separator to the given boolean value.
 void setParseIntegerOnly(boolean val)
          Sets the switch for parsing interger only to the given boolean value.

 

Methods inherited from class java.text.Format
format, formatToCharacterIterator, parseObject

 

Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

ALL_FIELD

public static final int ALL_FIELD
Constant for ALL field alignment. Used in FieldPosition of formatting. ALL is used to indicate all fields specified in a format pattern.
See Also:
Constant Field Values

INTEGER_FIELD

public static final int INTEGER_FIELD
Constant for INTEGER field alignment. Used in FieldPosition of formatting.
See Also:
Constant Field Values

FRACTION_FIELD

public static final int FRACTION_FIELD
Constant for FRACTION field alignment. Used in FieldPosition of formatting.
See Also:
Constant Field Values
Constructor Detail

OraNumberFormat

public OraNumberFormat()
Method Detail

getCurrencyInstance

public static oracle.i18n.text.OraNumberFormat getCurrencyInstance()
Returns a number formatter that uses the default currency format pattern for the default locale.
Returns:
a number formatter.

getCurrencyInstance

public static oracle.i18n.text.OraNumberFormat getCurrencyInstance(Locale locale)
Returns a number formatter that uses the default currency format pattern for the given locale.
Parameters:
locale - the given locale.
Returns:
a number formatter.

getCurrencyInstance

public static oracle.i18n.text.OraNumberFormat getCurrencyInstance(oracle.i18n.util.OraLocaleInfo localeInfo)
Returns a number formatter that uses the default currency format pattern for the given OraLocaleInfo.
Parameters:
localeInfo - the given OraLocaleInfo.
Returns:
a number formatter.

getDefaultCurrencyFormatPattern

public static String getDefaultCurrencyFormatPattern(Locale locale)
Returns the default currency format pattern for the given locale.
Parameters:
locale - the given locale.
Returns:
the default currency format pattern. The format pattern is in the form of
  "<positive pattern>;<negative pattern>"
or
  "<positive pattern>"
if patterns for both positive and negative patterns are the same.

getDefaultCurrencyFormatPattern

public static String getDefaultCurrencyFormatPattern(oracle.i18n.util.OraLocaleInfo localeInfo)
Returns the default currency format pattern for the given OraLocaleInfo.
Parameters:
localeInfo - the given OraLocaleInfo.
Returns:
the default currency format pattern. The format pattern is in the form of
  "<positive pattern>;<negative pattern>"
or
  "<positive pattern>"
if patterns for both positive and negative patterns are the same.

getDefaultNumberFormatPattern

public static String getDefaultNumberFormatPattern(Locale locale)
Returns the default number format pattern for the given locale.
Parameters:
locale - the given locale.
Returns:
the default currency format pattern. The format pattern is in the form of
  "<positive pattern>;<negative pattern>"
or
  "<positive pattern>"
if patterns for both positive and negative patterns are the same.

getDefaultNumberFormatPattern

public static String getDefaultNumberFormatPattern(oracle.i18n.util.OraLocaleInfo localeInfo)
Returns the default number format pattern for the given OraLocaleInfo.
Parameters:
localeInfo - the given OraLocaleInfo.
Returns:
the default currency format pattern. The format pattern is in the form of
  "<positive pattern>;<negative pattern>"
or
  "<positive pattern>"
if patterns for both positive and negative patterns are the same.

getInstance

public static oracle.i18n.text.OraNumberFormat getInstance()
Returns a number formatter that uses the default number format pattern for the default locale.
Returns:
a number formatter.

getInstance

public static oracle.i18n.text.OraNumberFormat getInstance(Locale locale)
Returns a number formatter that uses the default currency format pattern for the given locale.
Parameters:
locale - the given locale.
Returns:
a number formatter.

getInstance

public static oracle.i18n.text.OraNumberFormat getInstance(oracle.i18n.util.OraLocaleInfo localeInfo)
Returns a number formatter that uses the default currency format pattern for the given OraLocaleInfo.
Parameters:
localeInfo - the given OraLocaleInfo.
Returns:
a number formatter.

getNumberInstance

public static oracle.i18n.text.OraNumberFormat getNumberInstance()
Returns a number formatter that uses the default number format pattern for the default locale.
Returns:
a number formatter.

getNumberInstance

public static oracle.i18n.text.OraNumberFormat getNumberInstance(Locale locale)
Returns a number formatter that uses the default currency format pattern for the given locale.
Parameters:
locale - the given locale.
Returns:
a number formatter.

getNumberInstance

public static oracle.i18n.text.OraNumberFormat getNumberInstance(oracle.i18n.util.OraLocaleInfo localeInfo)
Returns a number formatter that uses the default currency format pattern for the given OraLocaleInfo.
Parameters:
localeInfo - the given OraLocaleInfo.
Returns:
a number formatter.

format

public String format(BigDecimal number)
Formats a BigDecimal into a string.
Parameters:
number - the BigDecimal object to be formatted into a string.
Returns:
a formatted string.

format

public String format(BigInteger number)
Formats a BigInteger into a string.
Parameters:
number - the BigInteger object to be formatted into a string.
Returns:
a formatted string.

format

public String format(double number)
Formats a double into a string.
Parameters:
number - the double to be formatted into a string.
Returns:
a formatted string.

format

public String format(long number)
Formats a long into a string.
Parameters:
number - the long to be formatted into a string.
Returns:
a formatted string.

format

public abstract StringBuffer format(BigDecimal number,
StringBuffer toAppendTo,
FieldPosition position)
Formats a BigDecimal into a string. Sets field position if it is needed.
Parameters:
number - the BigDecimal object to be formatted into a string.
toAppendTo - the string buffer to be appended with the formatted string.
Returns:
the string buffer appended with a formatted string.

format

public abstract StringBuffer format(BigInteger number,
StringBuffer toAppendTo,
FieldPosition position)
Formats a BigInteger into a string. Sets field position if it is needed.
Parameters:
number - the BigInteger object to be formatted into a string.
toAppendTo - the string buffer to be appended with the formatted string.
Returns:
the string buffer appended with a formatted string.

format

public abstract StringBuffer format(double number,
StringBuffer toAppendTo,
FieldPosition position)
Formats a double into a string. Sets field position if it is needed.
Parameters:
number - the double to be formatted into a string.
toAppendTo - the string buffer to be appended with the formatted string.
Returns:
the string buffer appended with a formatted string.

format

public abstract StringBuffer format(long number,
StringBuffer toAppendTo,
FieldPosition position)
Formats a long into a string. Sets field position if it is needed.
Parameters:
number - the long to be formatted into a string.
toAppendTo - the string buffer to be appended with the formatted string.
Returns:
the string buffer appended with a formatted string.

format

public StringBuffer format(Object number,
StringBuffer toAppendTo,
FieldPosition position)
Formats an Object into a string. Sets field position if it is needed.
Specified by:
format in class Format
Parameters:
toAppendTo - the string buffer to be appended with the formatted string.
Returns:
the string buffer appended with a formatted string.
Throws:
IllegalArgumentException - if the given object is not an instance of Number.

parse

public Number parse(String text)
             throws ParseException
Parses a string into a Number.
Parameters:
text - the string to be parsed.
Returns:
a Number corresponding to the string.
Throws:
ParseException - if the format pattern associated with this fromatter is not valid for parsing or the given string can not be parsed into a Number.

parse

public abstract Number parse(String text,
ParsePosition parsePosition)
Parses a string into a Number, starting from the given parse position.
Parameters:
text - the string
Returns:
a Number.
Throws:
IllegalArgumentException - if the format pattern associated with this fromatter is not valid for parsing or the given numerical string can not be parsed into a Date.

parseObject

public Object parseObject(String text,
ParsePosition parsePosition)
Parses a string into a (Number) Object, starting from the given parse position. It is a convenient method which simply calls parse(String, ParsePostion).
Specified by:
parseObject in class Format
See Also:
parse(String, ParsePosition).

isGroupingUsed

public boolean isGroupingUsed()
Checks if the grouping separator is used for this formatter.
Returns:
true if the grouping separator is used, false otherwise.

setGroupingUsed

public void setGroupingUsed(boolean val)
Sets the switch for grouping separator to the given boolean value.
Parameters:
val - the given boolean value.

isParseIntegerOnly

public boolean isParseIntegerOnly()
Checks if this formatter parses integer portion only.
Returns:
true if this formatter parses integer portion only, false otherwise.

setParseIntegerOnly

public void setParseIntegerOnly(boolean val)
Sets the switch for parsing interger only to the given boolean value.
Parameters:
val - the given boolean value.

clone

public Object clone()
Overrides the cloneable.
Overrides:
clone in class Format

equals

public boolean equals(Object obj)
Overrides the equals.
Overrides:
equals in class Object

Oracle® Globalization Development Kit Java API Reference
10g Release 1(10.1)

B10971-01

Copyright © 2003 Oracle Corporation. All Rights Reserved.