| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.text.Format
com.jgoodies.common.format.EmptyFormat
public class EmptyFormat
Wraps a given 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());
| Nested Class Summary | 
|---|
| Nested classes/interfaces inherited from class java.text.Format | 
|---|
| Format.Field | 
| Constructor Summary | |
|---|---|
| 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. | |
| Method Summary | |
|---|---|
|  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) | 
| Methods inherited from class java.text.Format | 
|---|
| clone, format | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public EmptyFormat(Format delegate)
null to the empty string and vice versa.
delegate - the format that handles the standard cases
NullPointerException - if delegate is null
public 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 string
NullPointerException - if delegate is null| Method Detail | 
|---|
public 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.
format in class Format
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 FormatParseException
public final Object parseObject(String source,
                                ParsePosition pos)
parseObject in class Formatpublic final AttributedCharacterIterator formatToCharacterIterator(Object obj)
formatToCharacterIterator in class Format| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||