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

B10971-01

oracle.i18n.text
Class OraDecimalFormat

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

public class OraDecimalFormat
extends OraNumberFormat

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

See Also:
OraNumberFormat, Serialized Form

Nested Class Summary

 

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

 

Field Summary

 

Fields inherited from class oracle.i18n.text.OraNumberFormat
ALL_FIELD, FRACTION_FIELD, INTEGER_FIELD

 

Constructor Summary
OraDecimalFormat()
          Constructs an OraDecimalformat using the default number format pattern and the default decimal format symbols for the default locale.
OraDecimalFormat(String pattern)
          Constructs an OraDecimalFormat using the given format pattern and the default decimal format symbols for the default locale.
OraDecimalFormat(String pattern, oracle.i18n.text.OraDecimalFormatSymbols symbols)
          Constructs an OraDecimalFormat using the given format pattern and the given decimal format symbols.

 

Method Summary
 void applyPattern(String pattern)
          Modifies this formatter by using the given format pattern.
 Object clone()
          Overrides the cloneable.
 boolean equals(Object object)
          Overrides the equals.
 StringBuffer format(BigDecimal number, StringBuffer toAppendTo, FieldPosition fieldPosition)
          Formats a BigDecimal into a string.
 StringBuffer format(BigInteger number, StringBuffer toAppendTo, FieldPosition fieldPosition)
          Formats a BigInteger into a string.
 StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition fieldPosition)
          Formats a double into a string.
 StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition fieldPosition)
          Formats a long into a string.
 oracle.i18n.text.OraDecimalFormatSymbols getOraDecimalFormatSymbols()
          Returns the Oracle decimal format symbols used in this formatter.
 int hashCode()
          Overrides the hashCode.
 boolean isDecimalSeparatorAlwaysShown()
          Returns true if decimal separator is always shown in the result string.
 Number parse(String text, ParsePosition parsePosition)
          Parses a string into a Number, starting from the given parse position.
 void setDecimalSeparatorAlwaysShown(boolean val)
          Sets the switch for decimal separator to the given boolean value.
 void setOraDecimalFormatSymbols(oracle.i18n.text.OraDecimalFormatSymbols sym)
          Sets this formatter to use the given Oracle decimal format symbols.
 String toPattern()
          Returns a format pattern string represents the formatting behavior of this formatter.

 

Methods inherited from class oracle.i18n.text.OraNumberFormat
format, format, format, format, format, getCurrencyInstance, getCurrencyInstance, getCurrencyInstance, getDefaultCurrencyFormatPattern, getDefaultCurrencyFormatPattern, getDefaultNumberFormatPattern, getDefaultNumberFormatPattern, getInstance, getInstance, getInstance, getNumberInstance, getNumberInstance, getNumberInstance, isGroupingUsed, isParseIntegerOnly, parse, parseObject, setGroupingUsed, setParseIntegerOnly

 

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

 

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

 

Constructor Detail

OraDecimalFormat

public OraDecimalFormat()
Constructs an OraDecimalformat using the default number format pattern and the default decimal format symbols for the default locale.

OraDecimalFormat

public OraDecimalFormat(String pattern)
                 throws ParseException
Constructs an OraDecimalFormat using the given format pattern and the default decimal format symbols for the default locale.
Parameters:
pattern - the given format pattern.
Throws:
ParseException - if the given pattern is invalid.

OraDecimalFormat

public OraDecimalFormat(String pattern,
                        oracle.i18n.text.OraDecimalFormatSymbols symbols)
                 throws ParseException
Constructs an OraDecimalFormat using the given format pattern and the given decimal format symbols.
Parameters:
pattern - the given format pattern.
Throws:
ParseException - if the given pattern is invalid.
Method Detail

applyPattern

public void applyPattern(String pattern)
                  throws ParseException
Modifies this formatter by using the given format pattern. The given format pattern should be specified as:
  "<positive pattern>[;<negative pattern>]"
which means that a positive format pattern should always be present but a negative format pattern is optional. If there is no negative pattern given, the positive pattern with a leading minus sign will be used for formatting/parsing negtive numbers.
Throws:
ParseException - if the given pattern is invalid.

format

public StringBuffer format(BigDecimal number,
StringBuffer toAppendTo,
FieldPosition fieldPosition)
Formats a BigDecimal into a string. Sets field position if it is needed.
Specified by:
format in class OraNumberFormat
Parameters:
number - the BigDecimal object to be formatted into a string.
toAppendTo - the string buffer to be appended with the formatted string.
fieldPosition - to be used to get offsets of a given field in the returned string buffer. On input: the alignment field of which the offsets to be returned. On output: the offsets of the alignment field in the returned string buffer.
Returns:
the string buffer appended with a formatted string.

format

public StringBuffer format(BigInteger number,
StringBuffer toAppendTo,
FieldPosition fieldPosition)
Formats a BigInteger into a string. Sets field position if it is needed.
Specified by:
format in class OraNumberFormat
Parameters:
number - the BigInteger object to be formatted into a string.
toAppendTo - the string buffer to be appended with the formatted string.
fieldPosition - to be used to get offsets of a given field in the returned string buffer. On input: the alignment field of which the offsets to be returned. On output: the offsets of the alignment field in the returned string buffer.
Returns:
the string buffer appended with a formatted string.

format

public StringBuffer format(double number,
StringBuffer toAppendTo,
FieldPosition fieldPosition)
Formats a double into a string. Sets field position if it is needed.
Specified by:
format in class OraNumberFormat
Parameters:
number - the double to be formatted into a string.
toAppendTo - the string buffer to be appended with the formatted string.
fieldPosition - to be used to get offsets of a given field in the returned string buffer. On input: the alignment field of which the offsets to be returned. On output: the offsets of the alignment field in the returned string buffer.
Returns:
the string buffer appended with a formatted string.

format

public StringBuffer format(long number,
StringBuffer toAppendTo,
FieldPosition fieldPosition)
Formats a long into a string. Sets field position if it is needed.
Specified by:
format in class OraNumberFormat
Parameters:
number - the long to be formatted into a string.
toAppendTo - the string buffer to be appended with the formatted string.
fieldPosition - to be used to get offsets of a given field in the returned string buffer. On input: the alignment field of which the offsets to be returned. On output: the offsets of the alignment field in the returned string buffer.
Returns:
the string buffer appended with a formatted string.

parse

public Number parse(String text,
ParsePosition parsePosition)
Parses a string into a Number, starting from the given parse position.
Specified by:
parse in class OraNumberFormat
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.

isDecimalSeparatorAlwaysShown

public boolean isDecimalSeparatorAlwaysShown()
Returns true if decimal separator is always shown in the result string.
Returns:
a boolean value.

setDecimalSeparatorAlwaysShown

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

getOraDecimalFormatSymbols

public oracle.i18n.text.OraDecimalFormatSymbols getOraDecimalFormatSymbols()
Returns the Oracle decimal format symbols used in this formatter.
Returns:
an OraDecimalFormatSymbols object.
See Also:
OraDecimalFormatSymbols

setOraDecimalFormatSymbols

public void setOraDecimalFormatSymbols(oracle.i18n.text.OraDecimalFormatSymbols sym)
Sets this formatter to use the given Oracle decimal format symbols.
Parameters:
sym - the given Oracle decimal format symbols.

toPattern

public String toPattern()
Returns a format pattern string represents the formatting behavior of this formatter.
Returns:
a format pattern string.

clone

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

equals

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

hashCode

public int hashCode()
Overrides the hashCode.
Overrides:
hashCode in class Object

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

B10971-01

Copyright © 2003 Oracle Corporation. All Rights Reserved.