org.apache.mailet.dates
Interface SimplifiedDateFormat

All Known Implementing Classes:
RFC2980DateFormat, RFC822DateFormat, RFC977DateFormat, SynchronizedDateFormat

public interface SimplifiedDateFormat

This interface is designed to provide a simplified subset of the methods provided by the java.text.DateFormat class.

This interface is necessary because of the difficulty in writing thread safe classes that inherit from java.text.DateFormat. This difficulty leads us to approach the problem using composition rather than inheritance. In general classes that implement this interface will delegate these calls to an internal DateFormat object.


Method Summary
 java.lang.String format(java.util.Date d)
          Formats a Date into a date/time string.
 java.util.TimeZone getTimeZone()
          Gets the time zone.
 boolean isLenient()
          Tell whether date/time parsing is to be lenient.
 java.util.Date parse(java.lang.String source)
          Parses text from the beginning of the given string to produce a date.
 void setLenient(boolean lenient)
          Specify whether or not date/time parsing is to be lenient.
 void setTimeZone(java.util.TimeZone zone)
          Sets the time zone of this SimplifiedDateFormat object.
 

Method Detail

format

java.lang.String format(java.util.Date d)
Formats a Date into a date/time string.

Parameters:
date - the time value to be formatted into a time string.
Returns:
the formatted time string.

parse

java.util.Date parse(java.lang.String source)
                     throws java.text.ParseException
Parses text from the beginning of the given string to produce a date. The method may not use the entire text of the given string.

Parameters:
source - A String whose beginning should be parsed.
Returns:
A Date parsed from the string.
Throws:
java.text.ParseException - if the beginning of the specified string cannot be parsed.

setTimeZone

void setTimeZone(java.util.TimeZone zone)
Sets the time zone of this SimplifiedDateFormat object.

Parameters:
zone - the given new time zone.

getTimeZone

java.util.TimeZone getTimeZone()
Gets the time zone.

Returns:
the time zone associated with this SimplifiedDateFormat.

setLenient

void setLenient(boolean lenient)
Specify whether or not date/time parsing is to be lenient. With lenient parsing, the parser may use heuristics to interpret inputs that do not precisely match this object's format. With strict parsing, inputs must match this object's format.

Parameters:
lenient - when true, parsing is lenient
See Also:
Calendar.setLenient(boolean)

isLenient

boolean isLenient()
Tell whether date/time parsing is to be lenient.

Returns:
whether this SimplifiedDateFormat is lenient.


Copyright © 2002-2007 The Apache Software Foundation. All Rights Reserved.