java.lang.Object
java.text.Format
com.jgoodies.validation.tutorial.formatted.format.DisplayFormat
- All Implemented Interfaces:
- java.lang.Cloneable, java.io.Serializable
- public final class DisplayFormat
- extends java.text.Format
Wraps a given Format and overrides that null
values are formatted to the empty string.
Examples:
new DisplayFormat(DateFormat.getDateInstance());
new DisplayFormat(new NumberFormat());
new DisplayFormat(new NumberFormat(), true);
- Version:
- $Revision: 1.4 $
| Nested classes inherited from class java.text.Format |
java.text.Format.Field |
|
Field Summary |
private java.text.Format |
delegate
Refers to the wrapped Format that is used to forward
#format. |
private boolean |
showClass
Describes whether the value's class is part of formatted output. |
| Fields inherited from class java.text.Format |
|
|
Constructor Summary |
DisplayFormat(java.text.Format format)
Constructs an EmptyFormat that wraps the given format
to convert null to the empty string and vice versa. |
DisplayFormat(java.text.Format format,
boolean showClass)
Constructs an EmptyFormat that wraps the given format
to convert null to the empty string and vice versa. |
delegate
private final java.text.Format delegate
- Refers to the wrapped Format that is used to forward
#format.
showClass
private final boolean showClass
- Describes whether the value's class is part of formatted output.
DisplayFormat
public DisplayFormat(java.text.Format format)
- Constructs an
EmptyFormat that wraps the given format
to convert null to the empty string and vice versa.
DisplayFormat
public DisplayFormat(java.text.Format format,
boolean showClass)
- Constructs an
EmptyFormat that wraps the given format
to convert null to the empty string and vice versa.
format
public java.lang.StringBuffer format(java.lang.Object obj,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
- Formats an object and appends the resulting text to a given string
buffer. If the
pos argument identifies a field used by
the format, then its indices are set to the beginning and end of
the first such field encountered.
shortClassName
private java.lang.String shortClassName(java.lang.Object object)
parseObject
public java.lang.Object parseObject(java.lang.String source,
java.text.ParsePosition pos)
- Parses text from a string to produce an object.