com.jgoodies.common.format
Class EmptyFormat
java.lang.Object
java.text.Format
com.jgoodies.common.format.EmptyFormat
- All Implemented Interfaces:
- Serializable, Cloneable
public class EmptyFormat
- extends Format
Wraps a given 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:
- Version:
- $Revision: 1.5 $
- Author:
- Karsten Lentzsch
- See Also:
- Serialized Form
|
Constructor Summary |
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. |
EmptyFormat
public EmptyFormat(Format delegate)
- Constructs an EmptyFormat that wraps the given mandatory forma
to convert
null to the empty string and vice versa.
- Parameters:
delegate - the format that handles the standard cases
- Throws:
NullPointerException - if delegate is null
EmptyFormat
public 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.
- Parameters:
delegate - the format that handles non-null valuesemptyValue - the representation of the empty string
- Throws:
NullPointerException - if delegate is null
format
public 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.
- Specified by:
format in class Format
parseObject
public Object parseObject(String source)
throws ParseException
source is empty or whitespace, the emptyValue
- Overrides:
parseObject in class Format
- Throws:
ParseException
parseObject
public final Object parseObject(String source,
ParsePosition pos)
- Specified by:
parseObject in class Format
formatToCharacterIterator
public final AttributedCharacterIterator formatToCharacterIterator(Object obj)
- Overrides:
formatToCharacterIterator in class Format
Copyright © 2009-2013 JGoodies Software GmbH. All Rights Reserved.