public class EmptyFormat extends Format
Format and adds behavior to convert to/fro
the empty string. Therefore it holds an empty valuenull) that i
mapped to/from the empty string. The #format resul
of the empty value is the empty string, and the #parseEmptyDateFormat or EmptyNumberFormat resp
Examples:Format.Field| Constructor and Description |
|---|
EmptyFormat(Format delegate)
Constructs an EmptyFormat that wraps the given mandatory forma
to convert
null to the empty string and vice versa. |
EmptyFormat(Format delegate,
Object emptyValue)
Constructs an EmptyFormat 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(Object obj,
StringBuffer toAppendTo,
FieldPosition pos)
obj is equal to the emptyValue
toAppendTo is returned. |
AttributedCharacterIterator |
formatToCharacterIterator(Object obj) |
Object |
parseObject(String source)
source is empty or whitespace, the emptyValue
|
Object |
parseObject(String source,
ParsePosition pos) |
public EmptyFormat(Format delegate)
null to the empty string and vice versa.delegate - the format that handles the standard casesNullPointerException - if delegate is nullpublic EmptyFormat(Format delegate, Object 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.
public Object parseObject(String source) throws ParseException
source is empty or whitespace, the emptyValue
parseObject in class FormatParseExceptionpublic final Object parseObject(String source, ParsePosition pos)
parseObject in class Formatpublic final AttributedCharacterIterator formatToCharacterIterator(Object obj)
formatToCharacterIterator in class FormatCopyright © 2009-2014 JGoodies Software GmbH. All Rights Reserved.