org.apache.mailet.dates
Class RFC977DateFormat

java.lang.Object
  extended by org.apache.mailet.dates.RFC977DateFormat
All Implemented Interfaces:
SimplifiedDateFormat

public class RFC977DateFormat
extends java.lang.Object
implements SimplifiedDateFormat

A thread-safe date formatting class to produce dates formatted in accord with the specifications of RFC 977.


Constructor Summary
RFC977DateFormat()
          Constructor for RFC977DateFormat
 
Method Summary
 boolean equals(java.lang.Object obj)
          Overrides equals
 java.lang.String format(java.util.Date d)
          This method returns the long form of the RFC977 Date
 java.util.TimeZone getTimeZone()
          Gets the time zone.
 int hashCode()
          Overrides hashCode
 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 SynchronizedDateFormat object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RFC977DateFormat

public RFC977DateFormat()
Constructor for RFC977DateFormat

Method Detail

format

public java.lang.String format(java.util.Date d)
This method returns the long form of the RFC977 Date

Specified by:
format in interface SimplifiedDateFormat
Parameters:
d - Date
Returns:
java.lang.String

parse

public 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.

This method is designed to be thread safe, so we wrap our delegated parse method in an appropriate synchronized block.

Specified by:
parse in interface SimplifiedDateFormat
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

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

Specified by:
setTimeZone in interface SimplifiedDateFormat
Parameters:
zone - the given new time zone.

getTimeZone

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

Specified by:
getTimeZone in interface SimplifiedDateFormat
Returns:
the time zone associated with this SynchronizedDateFormat.

setLenient

public 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.

Specified by:
setLenient in interface SimplifiedDateFormat
Parameters:
lenient - when true, parsing is lenient
See Also:
Calendar.setLenient(boolean)

isLenient

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

Specified by:
isLenient in interface SimplifiedDateFormat
Returns:
whether this SynchronizedDateFormat is lenient.

equals

public boolean equals(java.lang.Object obj)
Overrides equals

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides hashCode

Overrides:
hashCode in class java.lang.Object


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