public final class EmptyNumberFormat extends NumberFormat
NumberFormat and adds behavior to convert to/fro
the empty string. Therefore it holds an empty value that i
mapped to/from the empty string. The #format resul
of the empty value is the empty string, and the #parseExamples:NumberFormat.FieldFRACTION_FIELD, INTEGER_FIELD| Constructor and Description |
|---|
EmptyNumberFormat(NumberFormat delegate)
Constructs an EmptyNumberFormat that wraps the given mandatory forma
to convert
null to the empty string and vice versa. |
EmptyNumberFormat(NumberFormat delegate,
int emptyValue)
Constructs an EmptyNumberFormat that wraps the given mandatory forma
to convert the given
emptyValue to the empty strin
and vice versa. |
EmptyNumberFormat(NumberFormat delegate,
Number emptyValue)
Constructs an EmptyNumberFormat that wraps the given mandatory forma
to convert the given
emptyValue to the empty strin
and vice versa. |
| Modifier and Type | Method and Description |
|---|---|
StringBuffer |
format(double number,
StringBuffer toAppendTo,
FieldPosition pos) |
StringBuffer |
format(long number,
StringBuffer toAppendTo,
FieldPosition pos) |
StringBuffer |
format(Object obj,
StringBuffer toAppendTo,
FieldPosition pos)
obj is equal to the emptyValue
toAppendTo is returned. |
Number |
parse(String source)
source is empty or whitespace, the emptyValue
|
Number |
parse(String source,
ParsePosition pos) |
Object |
parseObject(String source)
source is empty or whitespace, the emptyValue
|
clone, equals, format, format, getAvailableLocales, getCurrency, getCurrencyInstance, getCurrencyInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getMaximumFractionDigits, getMaximumIntegerDigits, getMinimumFractionDigits, getMinimumIntegerDigits, getNumberInstance, getNumberInstance, getPercentInstance, getPercentInstance, getRoundingMode, hashCode, isGroupingUsed, isParseIntegerOnly, parseObject, setCurrency, setGroupingUsed, setMaximumFractionDigits, setMaximumIntegerDigits, setMinimumFractionDigits, setMinimumIntegerDigits, setParseIntegerOnly, setRoundingModeformat, formatToCharacterIteratorpublic EmptyNumberFormat(NumberFormat delegate)
null to the empty string and vice versa.delegate - the format that handles the standard casesNullPointerException - if delegate is nullpublic EmptyNumberFormat(NumberFormat delegate, int emptyValue)
emptyValue to the empty strin
and vice versa.delegate - the format that handles non-null valuesemptyValue - the representation of the empty stringNullPointerException - if delegate is nullpublic EmptyNumberFormat(NumberFormat delegate, Number emptyValue)
emptyValue to the empty strin
and vice versa.delegate - the format that handles non-null valuesemptyValue - the representation of the empty stringNullPointerException - if delegate is nullpublic StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
obj is equal to the emptyValue
toAppendTo is returned. Otherwise the forma
is forwarded to the delegate.
format in class NumberFormatpublic StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos)
format in class NumberFormatpublic StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos)
format in class NumberFormatpublic Object parseObject(String source) throws ParseException
source is empty or whitespace, the emptyValueparse(String, ParsePosition).
parseObject in class FormatParseExceptionpublic Number parse(String source) throws ParseException
source is empty or whitespace, the emptyValueparse(String, ParsePosition).
parse in class NumberFormatParseExceptionpublic Number parse(String source, ParsePosition pos)
parse in class NumberFormatCopyright © 2009-2014 JGoodies Software GmbH. All Rights Reserved.