public class OraDecimalFormat extends OraNumberFormat
OraDecimalFormat class is a concrete class to do locale-sensitive formatting and parsing between number and string. It supports Oracle number formatting behavior.OraNumberFormat, Serialized FormFormat.FieldALL_FIELD, FRACTION_FIELD, INTEGER_FIELD, SQLImplicit| Constructor and Description |
|---|
OraDecimalFormat()
Deprecated.
As of Oracle Database 10g Release 2 (10.2), replaced by
OraDecimalFormat.OraDecimalFormat(String, OraDecimalFormatSymbols) |
OraDecimalFormat(String pattern)
Deprecated.
As of Oracle Database 10g Release 2 (10.2), replaced by
OraDecimalFormat.OraDecimalFormat(String, OraDecimalFormatSymbols) |
OraDecimalFormat(String pattern, OraDecimalFormatSymbols symbols)
Constructs an
OraDecimalFormat object using the given format pattern and the given decimal format symbols. |
| Modifier and Type | Method and Description |
|---|---|
void |
applyPattern(String pattern)
Modifies this formatter by using the given format pattern.
|
Object |
clone()
Overrides the
clone method. |
boolean |
equals(Object object)
Overrides the
equals method. |
StringBuffer |
format(BigDecimal number, StringBuffer toAppendTo, FieldPosition fieldPosition)
Formats a
BigDecimal object into a string. |
StringBuffer |
format(BigInteger number, StringBuffer toAppendTo, FieldPosition fieldPosition)
Formats a
BigInteger object into a string. |
StringBuffer |
format(double number, StringBuffer toAppendTo, FieldPosition fieldPosition)
Formats a double number into a string.
|
StringBuffer |
format(long number, StringBuffer toAppendTo, FieldPosition fieldPosition)
Formats a long number into a string.
|
OraDecimalFormatSymbols |
getOraDecimalFormatSymbols()
Returns the Oracle decimal format symbols used in this formatter.
|
int |
hashCode()
Overrides the
hashCode method. |
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 object, starting from the given parse position. |
void |
setDecimalSeparatorAlwaysShown(boolean val)
Sets the switch for decimal separator to the given boolean value.
|
protected void |
setMaximumFractionDigits(int val) |
protected void |
setMaximumIntegerDigits(int val) |
protected void |
setMinimumFractionDigits(int val) |
protected void |
setMinimumIntegerDigits(int val) |
void |
setOraDecimalFormatSymbols(OraDecimalFormatSymbols sym)
Sets this formatter to use the given Oracle decimal format symbols.
|
String |
toPattern()
Returns a format pattern string that represents the formatting behavior of this formatter.
|
format, format, format, format, format, getCurrencyInstance, getCurrencyInstance, getCurrencyInstance, getDefaultCurrencyFormatPattern, getDefaultCurrencyFormatPattern, getDefaultNumberFormatPattern, getDefaultNumberFormatPattern, getInstance, getInstance, getInstance, getMaximumFractionDigits, getMinimumFractionDigits, getMinimumIntegerDigits, getNumberInstance, getNumberInstance, getNumberInstance, getSQLImplicitInstance, getSQLImplicitInstance, isGroupingUsed, isParseIntegerOnly, parse, parseObject, setGroupingUsed, setParseIntegerOnlyformat, formatToCharacterIterator, parseObjectpublic OraDecimalFormat()
OraDecimalFormat.OraDecimalFormat(String, OraDecimalFormatSymbols)OraDecimalFormat object using the default number format pattern and the default decimal format symbols for the default locale.public OraDecimalFormat(String pattern) throws ParseException
OraDecimalFormat.OraDecimalFormat(String, OraDecimalFormatSymbols)OraDecimalFormat object using the given format pattern and the default decimal format symbols for the default locale.pattern - the given format pattern, if null, uses the default number format pattern for the default locale and supports SQL TO_CHAR()/TO_NUMBER() implicit conversion.ParseException - if the given pattern is invalidpublic OraDecimalFormat(String pattern, OraDecimalFormatSymbols symbols) throws ParseException
OraDecimalFormat object using the given format pattern and the given decimal format symbols.pattern - the give format pattern, if null, uses the default number format pattern for the default locale and supports SQL TO_CHAR()/TO_NUMBER() implicit conversion.symbols - the given decimal format symbolsParseException - if the given pattern is invalidpublic void applyPattern(String pattern) throws ParseException
"<positive pattern>[;<negative pattern>]"This means that a positive format pattern must be present but a negative format pattern is optional. If there is no negative pattern given, the positive pattern with a leading minus sign is used for formatting or parsing negative numbers.
pattern - given format pattern, if null, uses the default number format pattern for the default locale and supports SQL TO_CHAR()/TO_NUMBER() implicit conversion.ParseException - if the given pattern is invalidpublic StringBuffer format(BigDecimal number, StringBuffer toAppendTo, FieldPosition fieldPosition)
BigDecimal object into a string. Sets field position if it is needed.format in class OraNumberFormatnumber - the BigDecimal object to be formatted.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 are to be returned. On output, the offsets of the alignment field in the returned string buffer.public StringBuffer format(BigInteger number, StringBuffer toAppendTo, FieldPosition fieldPosition)
BigInteger object into a string. Sets field position if it is needed.format in class OraNumberFormatnumber - the BigInteger object to be formatted.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 are to be returned. On output, the offsets of the alignment field in the returned string buffer.public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition fieldPosition)
format in class OraNumberFormatnumber - the double number to be formatted.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 are to be returned. On output, the offsets of the alignment field in the returned string buffer.public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition fieldPosition)
format in class OraNumberFormatnumber - the long number to be formatted.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 are to be returned. On output, the offsets of the alignment field in the returned string buffer.public Number parse(String text, ParsePosition parsePosition)
Number object, starting from the given parse position.parse in class OraNumberFormattext - the stringparsePosition - indicates where to start the parsing on input. On output, returns where the parse ends if parsing succeeds, or the start index if it fails.Number objectpublic boolean isDecimalSeparatorAlwaysShown()
true if decimal separator is always shown in the result string.public void setDecimalSeparatorAlwaysShown(boolean val)
val - the given boolean valuepublic OraDecimalFormatSymbols getOraDecimalFormatSymbols()
OraDecimalFormatSymbols objectOraDecimalFormatSymbolspublic void setOraDecimalFormatSymbols(OraDecimalFormatSymbols sym)
sym - the given Oracle decimal format symbolspublic String toPattern()
protected void setMaximumIntegerDigits(int val)
setMaximumIntegerDigits in class OraNumberFormatprotected void setMinimumIntegerDigits(int val)
setMinimumIntegerDigits in class OraNumberFormatprotected void setMaximumFractionDigits(int val)
setMaximumFractionDigits in class OraNumberFormatprotected void setMinimumFractionDigits(int val)
setMinimumFractionDigits in class OraNumberFormatpublic Object clone()
clone method.clone in class OraNumberFormatpublic boolean equals(Object object)
equals method.equals in class OraNumberFormatobject - an object to be comparedtrue if two objects are identical, otherwise false