org.progeeks.meta.format
Class DatePropertyFormat

java.lang.Object
  extended by org.progeeks.meta.format.AbstractPropertyFormat
      extended by org.progeeks.meta.format.DatePropertyFormat
All Implemented Interfaces:
PropertyFormat

public class DatePropertyFormat
extends AbstractPropertyFormat

PropertyFormat implementation that uses a SimpleDateFormat to convert java.util.Date objects (and their subclasses) to a consistent date string. Note that the use of SimpleDateFormat instances by this class is not synchronized, so users of this class must synchronize themselves if the DatePropertyFormat will be accessed by multiple threads. Defaults to the format: 2001-02-28 13:45:01

Version:
$Revision: 1.5 $
Author:
Paul Speed

Field Summary
static java.lang.String DEFAULT_FORMAT
           
 
Constructor Summary
DatePropertyFormat()
          Creates a DatePropertyFormat using the DEFAULT_FORMAT.
DatePropertyFormat(java.lang.String formatString)
          Creates a new DatePropertyFormat using the specified SimpleDateFormat format string.
DatePropertyFormat(java.lang.String formatString, java.lang.String timeZoneId)
           
 
Method Summary
 java.lang.String format(java.lang.Object obj)
          Returns the formatted String for the specified Object.
 java.lang.String getFormatString()
          Returns the SimpleDateFormat format string for this property format.
 java.lang.String getTimeZoneId()
           
 java.lang.Object parseObject(java.lang.String source, int index)
          Parses the text starting at the specified index and converts it into an Object of the appropriate type.
 void setFormatString(java.lang.String formatString)
          Sets the SimpleDateFormat format string for this property format.
 void setTimeZoneId(java.lang.String id)
           
 java.lang.String toString()
          String summary.
 
Methods inherited from class org.progeeks.meta.format.AbstractPropertyFormat
format, parseObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_FORMAT

public static final java.lang.String DEFAULT_FORMAT
See Also:
Constant Field Values
Constructor Detail

DatePropertyFormat

public DatePropertyFormat()
Creates a DatePropertyFormat using the DEFAULT_FORMAT.


DatePropertyFormat

public DatePropertyFormat(java.lang.String formatString)
Creates a new DatePropertyFormat using the specified SimpleDateFormat format string.


DatePropertyFormat

public DatePropertyFormat(java.lang.String formatString,
                          java.lang.String timeZoneId)
Method Detail

setFormatString

public void setFormatString(java.lang.String formatString)
Sets the SimpleDateFormat format string for this property format.


getFormatString

public java.lang.String getFormatString()
Returns the SimpleDateFormat format string for this property format.


setTimeZoneId

public void setTimeZoneId(java.lang.String id)

getTimeZoneId

public java.lang.String getTimeZoneId()

format

public java.lang.String format(java.lang.Object obj)
Returns the formatted String for the specified Object.

Specified by:
format in interface PropertyFormat
Specified by:
format in class AbstractPropertyFormat

parseObject

public java.lang.Object parseObject(java.lang.String source,
                                    int index)
Parses the text starting at the specified index and converts it into an Object of the appropriate type. If this method is not supported then an UnsupportedOperationException will be thrown.

Specified by:
parseObject in interface PropertyFormat
Specified by:
parseObject in class AbstractPropertyFormat

toString

public java.lang.String toString()
String summary.

Overrides:
toString in class java.lang.Object


Copyright © 2002-2003 Paul Speed. All Rights Reserved.