public class EmptyFormat extends Format
Format and adds behavior to convert to/from
 the empty string. Therefore it holds an empty value
 (often null) that is
 mapped to/from the empty string. The #format result
 of the empty value is the empty string, and the #parse
 result of the empty string is the empty value. In all other cases
 the formatting and parsing is forwarded to the wrapped Format.
 If you want to wrap a DateFormat or NumberFormat, you may use
 EmptyDateFormat or EmptyNumberFormat resp.
 Examples:
new EmptyFormat(new WeightFormat());
Format.Field| Constructor and Description | 
|---|
| EmptyFormat(Format delegate)Constructs an EmptyFormat that wraps the given mandatory format
 to convert  nullto the empty string and vice versa. | 
| EmptyFormat(Format delegate,
           Object emptyValue)Constructs an EmptyFormat that wraps the given mandatory format
 to convert the given  emptyValueto the empty string
 and vice versa. | 
| Modifier and Type | Method and Description | 
|---|---|
| StringBuffer | format(Object obj,
      StringBuffer toAppendTo,
      FieldPosition pos)
 If  objis equal to the emptyValue,toAppendTois returned. | 
| AttributedCharacterIterator | formatToCharacterIterator(Object obj) | 
| Object | parseObject(String source)
 If  sourceis empty or whitespace, the emptyValue
 is returned. | 
| 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 string
 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)
 If obj is equal to the emptyValue,
 toAppendTo is returned. Otherwise the format
 is forwarded to the delegate.
public Object parseObject(String source) throws ParseException
 If source is empty or whitespace, the emptyValue
 is returned. Otherwise parsing is forwarded to the delegate.
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.