com.jgoodies.common.format
Class EmptyDateFormat
java.lang.Object
   java.text.Format
java.text.Format
       java.text.DateFormat
java.text.DateFormat
           com.jgoodies.common.format.AbstractWrappedDateFormat
com.jgoodies.common.format.AbstractWrappedDateFormat
               com.jgoodies.common.format.EmptyDateFormat
com.jgoodies.common.format.EmptyDateFormat
- All Implemented Interfaces: 
- Serializable, Cloneable
- public final class EmptyDateFormat 
- extends AbstractWrappedDateFormat
Wraps a given DateFormat and adds behavior to convert to/from
 the empty string. Therefore it holds an empty value 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 DateFormat.
 Often the empty value is null but you can construct an
 EmptyDateFormat with a given Date.
 Examples:
 new EmptyDateFormat(DateFormat.getDateInstance());
 new EmptyDateFormat(DateFormat.getDateInstance(), new Date());
 new EmptyDateFormat(DateFormat.getDateInstance(DateFormat.SHORT));
 new EmptyDateFormat(DateFormat.getDateInstance(DateFormat.SHORT), new Date());
 
- Version:
- $Revision: 1.1 $
- Author:
- Karsten Lentzsch
- See Also:
- Serialized Form
 
 
 
 
| Fields inherited from class java.text.DateFormat | 
| AM_PM_FIELD, calendar, DATE_FIELD, DAY_OF_WEEK_FIELD, DAY_OF_WEEK_IN_MONTH_FIELD, DAY_OF_YEAR_FIELD, DEFAULT, ERA_FIELD, FULL, HOUR_OF_DAY0_FIELD, HOUR_OF_DAY1_FIELD, HOUR0_FIELD, HOUR1_FIELD, LONG, MEDIUM, MILLISECOND_FIELD, MINUTE_FIELD, MONTH_FIELD, numberFormat, SECOND_FIELD, SHORT, TIMEZONE_FIELD, WEEK_OF_MONTH_FIELD, WEEK_OF_YEAR_FIELD, YEAR_FIELD | 
 
| Constructor Summary | 
| EmptyDateFormat(DateFormat delegate)Constructs an
 EmptyFormatthat wraps the given mandatory format
 to convertnullto the empty string and vice versa. | 
| EmptyDateFormat(DateFormat delegate,
                Date emptyValue)Constructs an
 EmptyFormatthat wraps the given mandatory format
 to convert the givenemptyValueto the empty string
 and vice versa. | 
 
 
 
| Methods inherited from class java.text.DateFormat | 
| clone, equals, format, format, getAvailableLocales, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getTimeInstance, getTimeInstance, getTimeInstance, hashCode, parse, parseObject | 
 
 
 
EmptyDateFormat
public EmptyDateFormat(DateFormat delegate)
- Constructs an EmptyFormatthat wraps the given mandatory format
 to convertnullto the empty string and vice versa.
 
- Parameters:
- delegate- the format that handles the standard cases
- Throws:
- NullPointerException- if- delegateis- null
 
EmptyDateFormat
public EmptyDateFormat(DateFormat delegate,
                       Date emptyValue)
- Constructs an EmptyFormatthat wraps the given mandatory format
 to convert the givenemptyValueto the empty string
 and vice versa.
 
- Parameters:
- delegate- the format that handles non-- nullvalues
- emptyValue- the representation of the empty string
- Throws:
- NullPointerException- if- delegateis- null
 
format
public StringBuffer format(Date date,
                           StringBuffer toAppendTo,
                           FieldPosition pos)
- 
- Specified by:
- formatin class- AbstractWrappedDateFormat
 
- 
 
parse
public Date parse(String source,
                  ParsePosition pos)
- 
- Specified by:
- parsein class- AbstractWrappedDateFormat
 
- 
 
Copyright © 2009-2012 JGoodies Karsten Lentzsch. All Rights Reserved.