|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.polliwog.fields.AbstractField org.polliwog.fields.DateTimeField
public class DateTimeField
A date/time field, this class allows representation of a date/time from the log entry.
The date/time format that should be used is defined by passing the parameter:
FORMAT
to the init(Map,String)
method, the format must conform to
that defined in the java.text.SimpleDateFormat class.
Timezones are supported by passing the parameter:
#TIMEZONE
to the init(Map,String)
method.
Example:
DateTimeField dtf = new DateTimeField (); // Create the parms. Map params = new HashMap (); // The format used must conform to that defined in the java.text.SimpleDateFormat // class. params.put (DateTimeField.FORMAT, "dd/MMM/yyyy:HH:mm:ss Z"); params.put (DateTimeField.TIMEZONE, "Australia/Brisbane"); dft.init (params, value);A future extension to this will probably allow for re-use of the SimpleDateFormat instance, perhaps by using a static variable.
Last Modified By: $Author: barrygently $ Last Modified On: $Date: 2005/07/04 14:00:02 $ Current Revision: $Revision: 1.3 $
Field Summary | |
---|---|
static java.util.Locale |
DEFAULT_LOCALE
|
static int |
FIELD_ID
This is a unique constant for this field, it MUST NOT clash with any other field constant value otherwise incorrect casting may result. |
static java.lang.String |
FORMAT
|
static java.lang.String |
LOCALE
|
Constructor Summary | |
---|---|
DateTimeField()
|
Method Summary | |
---|---|
void |
clear()
Clear the data that the field holds. |
java.util.Date |
getDate()
Get the date created from the field value. |
int |
getFieldId()
Should return a unique id for this field, this is to help with classes (such as: Hit )
that use this id to help in identification. |
void |
init(java.util.Map params,
java.lang.String value)
Init the field with the date/time value. |
java.lang.String |
toString()
Get a string representation of the date, just returns Date.toString. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int FIELD_ID
public static final java.util.Locale DEFAULT_LOCALE
public static final java.lang.String FORMAT
public static final java.lang.String LOCALE
Constructor Detail |
---|
public DateTimeField()
Method Detail |
---|
public void clear()
AbstractField
clear
in class AbstractField
public java.util.Date getDate()
public java.lang.String toString()
toString
in class java.lang.Object
public void init(java.util.Map params, java.lang.String value) throws WeblogException
The params Map must contain a FORMAT
entry that maps to a date/time
format spec (that conforms to that defined in the java.text.SimpleDateFormat class).
It is that format that is used to parse the value parm.
An optional #TIMEZONE
param is also supported which should map to a valid
timezone.
init
in class AbstractField
params
- A Map of name/value pairs that hold configuration values.value
- The value to convert to a date/time.
WeblogException
- Throw if something is wrong with the value.public int getFieldId()
AbstractField
Hit
)
that use this id to help in identification.
getFieldId
in class AbstractField
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |