Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.jgoodies.validation.tutorial.formatted.format
Class DisplayFormat  view DisplayFormat download DisplayFormat.java

java.lang.Object
  extended byjava.text.Format
      extended bycom.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 Class Summary
 
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.
 
Method Summary
 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.
 java.lang.Object parseObject(java.lang.String source, java.text.ParsePosition pos)
          Parses text from a string to produce an object.
private  java.lang.String shortClassName(java.lang.Object object)
           
 
Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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.

Constructor Detail

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.

Method Detail

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.