com.waveset.msgcat
Class DateTime

java.lang.Object
  extended bycom.waveset.util.AbstractXmlObject
      extended bycom.waveset.msgcat.MessageParameter
          extended bycom.waveset.msgcat.DateTime
All Implemented Interfaces:
javax.naming.Referenceable, XmlObject

public class DateTime
extends MessageParameter

An object that encapsulates a date/time that can be passed as a parameter to a localizable Message. Localization is not performed until called upon by the Catalog.


Field Summary
static java.lang.String ATT_JAN_1970_MILLIS
           
static java.lang.String ATT_STYLE
           
static java.lang.String code_id
           
static int DATE_FULL
           
static int DATE_LONG
           
static int DATE_MEDIUM
           
static int DATE_SHORT
           
static int DATETIME_FULL
           
static int DATETIME_LONG
           
static int DATETIME_MEDIUM
           
static int DATETIME_SHORT
           
static java.lang.String ELEMENT
           
static java.lang.String INVALID_DATETIME
           
static int TIME_FULL
           
static int TIME_LONG
           
static int TIME_MEDIUM
           
static int TIME_SHORT
           
 
Fields inherited from class com.waveset.util.AbstractXmlObject
_trace
 
Constructor Summary
DateTime()
          Create a new localizable date/time message parameter using the current time.
DateTime(java.util.Date datetime)
          Create a new localizable date/time message parameter, with default style set to DATETIME_FULL.
DateTime(java.util.Date datetime, int style)
          Create a new localizable date/time message parameter.
DateTime(org.w3c.dom.Element e)
          Construct a date/time from XML.
DateTime(int style)
          Create a new localizable date/time message parameter using the current time.
DateTime(long datetime_millis)
          Create a new localizable date/time message parameter, with default style set to DATETIME_FULL.
DateTime(long datetime_millis, int style)
          Create a new localizable date/time message parameter.
DateTime(java.lang.String datetime_millis)
          Create a new localizable date/time message parameter from a string.
DateTime(java.lang.String datetime_millis, int style)
          Create a new localizable date/time message parameter from a string.
 
Method Summary
protected  void addSubclassAttributes(java.lang.StringBuffer b)
           
protected  void addSubclassElements(java.lang.StringBuffer b, int indent)
           
 boolean equals(java.lang.Object o)
          Determine equivalence.
static java.lang.String format(java.util.Date datetime, int style, java.util.Locale locale)
           
static java.lang.String format(java.util.Date datetime, java.util.Locale locale)
           
static java.lang.String format(java.util.Locale locale)
           
static java.lang.String format(long datetime_millis, int style, java.util.Locale locale)
           
static java.lang.String format(long datetime_millis, java.util.Locale locale)
           
protected  java.util.Date getDateTime()
          Get the date/time.
 java.lang.String getElementName()
          Get the xml element name.
protected  int getStyle()
          Get the style.
 long getTime()
           
protected  void parseSubclassAttributes(org.w3c.dom.Element e)
           
protected  void parseSubclassElements(org.w3c.dom.Element e)
           
 void parseXml(org.w3c.dom.Element e)
           
protected  void setDateTime(java.util.Date datetime)
          Set the date/time.
protected  void setDateTime(long datetime_millis)
          Set the date/time.
protected  void setStyle(int style)
          Set the style.
 java.lang.String toString()
          Localize this date/time to the default locale.
 java.lang.String toString(java.util.Locale locale)
          Localize this date/time.
 java.lang.String toXml()
          Serialize this object as an XML string.
 void toXml(java.lang.StringBuffer b, int indent)
          Serialize this object as an XML string.
 
Methods inherited from class com.waveset.util.AbstractXmlObject
addXmlHeader, cloneObject, dump, dumpFile, getReference, println, setTrace, toIdentityString, toVerboseString, toVerboseString, toXml, toXml
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

ELEMENT

public static final java.lang.String ELEMENT
See Also:
Constant Field Values

DATE_SHORT

public static final int DATE_SHORT
See Also:
Constant Field Values

DATE_MEDIUM

public static final int DATE_MEDIUM
See Also:
Constant Field Values

DATE_LONG

public static final int DATE_LONG
See Also:
Constant Field Values

DATE_FULL

public static final int DATE_FULL
See Also:
Constant Field Values

TIME_SHORT

public static final int TIME_SHORT
See Also:
Constant Field Values

TIME_MEDIUM

public static final int TIME_MEDIUM
See Also:
Constant Field Values

TIME_LONG

public static final int TIME_LONG
See Also:
Constant Field Values

TIME_FULL

public static final int TIME_FULL
See Also:
Constant Field Values

DATETIME_SHORT

public static final int DATETIME_SHORT
See Also:
Constant Field Values

DATETIME_MEDIUM

public static final int DATETIME_MEDIUM
See Also:
Constant Field Values

DATETIME_LONG

public static final int DATETIME_LONG
See Also:
Constant Field Values

DATETIME_FULL

public static final int DATETIME_FULL
See Also:
Constant Field Values

INVALID_DATETIME

public static final java.lang.String INVALID_DATETIME
See Also:
Constant Field Values

ATT_JAN_1970_MILLIS

public static final java.lang.String ATT_JAN_1970_MILLIS
See Also:
Constant Field Values

ATT_STYLE

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

DateTime

public DateTime(org.w3c.dom.Element e)
         throws WavesetException
Construct a date/time from XML.


DateTime

public DateTime(int style)
Create a new localizable date/time message parameter using the current time.

Parameters:
style - Indicates format style for the date/time.

DateTime

public DateTime()
Create a new localizable date/time message parameter using the current time.


DateTime

public DateTime(java.util.Date datetime,
                int style)
Create a new localizable date/time message parameter.

Parameters:
datetime - The date/time parameter.
style - Indicates format style for the date/time.

DateTime

public DateTime(java.util.Date datetime)
Create a new localizable date/time message parameter, with default style set to DATETIME_FULL.

Parameters:
datetime - The date/time parameter.

DateTime

public DateTime(long datetime_millis,
                int style)
Create a new localizable date/time message parameter.

Parameters:
datetime_millis - The date/time parameter in milliseconds since Jan 1 1970.
style - Indicates format style for the date/time.

DateTime

public DateTime(long datetime_millis)
Create a new localizable date/time message parameter, with default style set to DATETIME_FULL.

Parameters:
datetime_millis - The date/time parameter in milliseconds since Jan 1 1970.

DateTime

public DateTime(java.lang.String datetime_millis,
                int style)
Create a new localizable date/time message parameter from a string. Default assumption is that the string is the number of milliseconds since jan 1 1970.

Parameters:
datetime_millis - The date/time parameter in milliseconds since Jan 1 1970.
style - Indicates format style for the date/time.

DateTime

public DateTime(java.lang.String datetime_millis)
Create a new localizable date/time message parameter from a string. Default assumption is that the string is the number of milliseconds since jan 1 1970. Default style set to DATETIME_FULL.

Parameters:
datetime_millis - The date/time parameter in milliseconds since Jan 1 1970.
Method Detail

format

public static java.lang.String format(java.util.Date datetime,
                                      int style,
                                      java.util.Locale locale)

format

public static java.lang.String format(long datetime_millis,
                                      int style,
                                      java.util.Locale locale)

format

public static java.lang.String format(java.util.Date datetime,
                                      java.util.Locale locale)

format

public static java.lang.String format(long datetime_millis,
                                      java.util.Locale locale)

format

public static java.lang.String format(java.util.Locale locale)

getElementName

public java.lang.String getElementName()
Get the xml element name.

Specified by:
getElementName in interface XmlObject
Specified by:
getElementName in class AbstractXmlObject

getDateTime

protected java.util.Date getDateTime()
Get the date/time.


getStyle

protected int getStyle()
Get the style.


setDateTime

protected void setDateTime(java.util.Date datetime)
Set the date/time.

Parameters:
datetime - The date/time parameter.

setDateTime

protected void setDateTime(long datetime_millis)
Set the date/time.

Parameters:
datetime_millis - The date/time parameter in milliseconds since Jan 1 1970.

setStyle

protected void setStyle(int style)
Set the style.

Parameters:
style - Indicates format style for the date/time.

toString

public java.lang.String toString(java.util.Locale locale)
Localize this date/time.

Specified by:
toString in class MessageParameter
Parameters:
locale - The locale to use.

toString

public java.lang.String toString()
Localize this date/time to the default locale.

Specified by:
toString in class MessageParameter

getTime

public long getTime()

addSubclassAttributes

protected void addSubclassAttributes(java.lang.StringBuffer b)

addSubclassElements

protected void addSubclassElements(java.lang.StringBuffer b,
                                   int indent)

parseSubclassAttributes

protected void parseSubclassAttributes(org.w3c.dom.Element e)
                                throws WavesetException
Throws:
WavesetException

parseSubclassElements

protected void parseSubclassElements(org.w3c.dom.Element e)
                              throws WavesetException
Throws:
WavesetException

toXml

public void toXml(java.lang.StringBuffer b,
                  int indent)
Serialize this object as an XML string.

Specified by:
toXml in interface XmlObject
Specified by:
toXml in class AbstractXmlObject

parseXml

public void parseXml(org.w3c.dom.Element e)
              throws WavesetException
Throws:
WavesetException

toXml

public java.lang.String toXml()
Serialize this object as an XML string.

Specified by:
toXml in interface XmlObject
Overrides:
toXml in class AbstractXmlObject

equals

public boolean equals(java.lang.Object o)
Determine equivalence. Used for testing.