|
Project Wonder 5.0 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectjava.text.Format
com.webobjects.foundation.NSNumberFormatter
er.extensions.formatters.ERXNumberFormatter
public class ERXNumberFormatter
An extension to the number formatter. It
will strip out the characters '%$,' when parsing
a string and can scale values by setting a pattern like
(/1024=)0.00 KB which will divide the actual value by 1024 or
(*60;4=)0.00 which will multiply the actual value by 60.
When used for parsing, the resulting value will be scaled to a scale of 4.
So when the real value is 0.0165, the display value will be 0.99 and
when this is re-entered, the resulting value will again be 0.0165.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.text.Format |
|---|
java.text.Format.Field |
| Field Summary | |
|---|---|
protected static java.lang.String |
DefaultKey
|
| Fields inherited from class com.webobjects.foundation.NSNumberFormatter |
|---|
_CLASS, _CurrencyPattern, _DecimalPattern, _IntegerPattern, DefaultPattern, NSDecimalNotANumber, RoundBankers, RoundDown, RoundPlain, RoundUp |
| Constructor Summary | |
|---|---|
ERXNumberFormatter()
|
|
ERXNumberFormatter(java.lang.String pattern)
Public constructor |
|
| Method Summary | |
|---|---|
static java.text.Format |
defaultNumberFormatterForObject(java.lang.Object object)
|
java.lang.StringBuffer |
format(java.lang.Object value,
java.lang.StringBuffer buffer,
java.text.FieldPosition position)
Overridden to perform optional conversions on the value given. |
static com.webobjects.foundation.NSNumberFormatter |
numberFormatterForPattern(java.lang.String pattern)
Returns a shared instance for the specified pattern. |
java.lang.Object |
parseObject(java.lang.String aString)
Strips out the ignored characters and optionally performs an operation on the value from the string to be parsed. |
protected java.math.BigDecimal |
performFormat(java.math.BigDecimal value)
Override this in your subclass to provide for other operations when formatting a value. |
protected java.math.BigDecimal |
performParse(java.math.BigDecimal value)
Override this in your subclass to provide for other operations when parsing a value. |
protected void |
setFactor(java.math.BigDecimal value)
|
void |
setIgnoredChars(java.lang.String value)
|
static void |
setNumberFormatterForPattern(com.webobjects.foundation.NSNumberFormatter formatter,
java.lang.String pattern)
Sets a shared instance for the specified pattern. |
protected void |
setOperator(java.lang.String value)
|
void |
setPattern(java.lang.String pattern)
Overridden to search the pattern for operators and factors. |
protected void |
setScale(java.lang.Integer value)
|
static com.webobjects.foundation.NSNumberFormatter |
sharedInstance()
Returns the default shared instance |
| Methods inherited from class com.webobjects.foundation.NSNumberFormatter |
|---|
allowsFloats, attributedStringForNil, attributedStringForNotANumber, attributedStringForZero, availableLocales, currencySymbol, decimalSeparator, defaultLocale, defaultLocalizesPattern, format, hasThousandSeparators, locale, localizesFormat, localizesPattern, maximum, minimum, negativeFormat, negativePattern, objectValueForString, parseObject, pattern, positiveFormat, positivePattern, roundingBehavior, setAllowsFloats, setAttributedStringForNil, setAttributedStringForNotANumber, setAttributedStringForZero, setCurrencySymbol, setDecimalSeparator, setDefaultLocale, setDefaultLocalizesPattern, setFormat, setHasThousandSeparators, setLocale, setLocalizesFormat, setLocalizesPattern, setMaximum, setMinimum, setNegativeFormat, setNegativePattern, setPositiveFormat, setPositivePattern, setRoundingBehavior, setStringForNotANumber, setStringForNull, setStringForZero, setThousandSeparator, stringForNotANumber, stringForNull, stringForObjectValue, stringForZero, thousandSeparator |
| Methods inherited from class java.text.Format |
|---|
clone, format, formatToCharacterIterator |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String DefaultKey
| Constructor Detail |
|---|
public ERXNumberFormatter(java.lang.String pattern)
public ERXNumberFormatter()
| Method Detail |
|---|
public static com.webobjects.foundation.NSNumberFormatter sharedInstance()
public static java.text.Format defaultNumberFormatterForObject(java.lang.Object object)
object - public static com.webobjects.foundation.NSNumberFormatter numberFormatterForPattern(java.lang.String pattern)
public static void setNumberFormatterForPattern(com.webobjects.foundation.NSNumberFormatter formatter,
java.lang.String pattern)
public void setIgnoredChars(java.lang.String value)
protected void setFactor(java.math.BigDecimal value)
protected void setOperator(java.lang.String value)
protected void setScale(java.lang.Integer value)
public void setPattern(java.lang.String pattern)
'(' . operatorChar . factor . [';' scale ] . '=)' normalFormatterString
setPattern in class com.webobjects.foundation.NSNumberFormatterNSNumberFormatter.setPattern(java.lang.String)protected java.math.BigDecimal performFormat(java.math.BigDecimal value)
value - protected java.math.BigDecimal performParse(java.math.BigDecimal value)
value -
public java.lang.Object parseObject(java.lang.String aString)
throws java.text.ParseException
parseObject in class com.webobjects.foundation.NSNumberFormatteraString - to be parsed
java.text.ParseException
public java.lang.StringBuffer format(java.lang.Object value,
java.lang.StringBuffer buffer,
java.text.FieldPosition position)
format in class com.webobjects.foundation.NSNumberFormatterFormat.format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)
|
Last updated: Tue, Feb 21, 2017 05:45 PM CET | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||