Public Member Functions | Static Public Member Functions | Static Public Attributes

org.exolab.castor.types.Date Class Reference

Inheritance diagram for org.exolab.castor.types.Date:
org.exolab.castor.types.DateTimeBase org.exolab.castor.types.GMonthDay org.exolab.castor.types.GYearMonth org.exolab.castor.types.GDay org.exolab.castor.types.GMonth org.exolab.castor.types.GYear

List of all members.

Public Member Functions

 Date ()
 Date (short[] values)
 Date (java.util.Date dateRef)
 Date (String date) throws java.text.ParseException
void setValues (short[] values)
short[] getValues ()
java.util.Date toDate ()
String toString ()
short getHour ()
short getMinute ()
short getSeconds ()
short getMilli ()
void setHour (short hour)
void setMinute (short minute)
void setSecond (short second)
void setMilliSecond (short millisecond)

Static Public Member Functions

static Object parse (String str) throws ParseException
static Date parseDate (String str) throws ParseException

Static Public Attributes

static final String DATE_FORMAT = "yyyy-MM-dd"

Detailed Description

Describe an XML schema Date.

The format is defined by W3C XML Schema Recommendation and ISO8601 i.e (-)CCYY-MM-DD(Z|(+|-)hh:mm)

Author:
Arnaud Blandin
Version:
Revision:
1.1.1.1

Constructor & Destructor Documentation

org.exolab.castor.types.Date.Date ( short[]  values  ) 

Constructs a XML Schema Date instance given all the values of the different fields. By default a Date is not UTC and is local.

Parameters:
values an array of shorts that represent the different fields of Time.

References org.exolab.castor.types.Date.setValues().

org.exolab.castor.types.Date.Date ( java.util.Date  dateRef  ) 

This constructor is used to convert a java.util.Date into a new org.exolab.castor.types.Date

Note : all the information concerning the time part of the java.util.Date is lost since a W3C Schema Date only represents CCYY-MM-YY

References org.exolab.castor.types.DateTimeBase.setCentury(), org.exolab.castor.types.DateTimeBase.setDay(), org.exolab.castor.types.DateTimeBase.setMonth(), and org.exolab.castor.types.DateTimeBase.setYear().

org.exolab.castor.types.Date.Date ( String  date  )  throws java.text.ParseException

Constructs a date from a string

Parameters:
date the string representing the date

Member Function Documentation

short org.exolab.castor.types.Date.getHour (  ) 
short org.exolab.castor.types.Date.getMilli (  ) 
short org.exolab.castor.types.Date.getMinute (  ) 
short org.exolab.castor.types.Date.getSeconds (  ) 
short [] org.exolab.castor.types.Date.getValues (  )  [virtual]

Returns an array of short with all the fields that describe this Date type.

Note:the time zone is not included.

Returns:
an array of short with all the fields that describe this Date type.

Implements org.exolab.castor.types.DateTimeBase.

Reimplemented in org.exolab.castor.types.GMonthDay, org.exolab.castor.types.GYear, and org.exolab.castor.types.GYearMonth.

References org.exolab.castor.types.DateTimeBase.getCentury(), org.exolab.castor.types.DateTimeBase.getDay(), org.exolab.castor.types.DateTimeBase.getMonth(), and org.exolab.castor.types.DateTimeBase.getYear().

static Object org.exolab.castor.types.Date.parse ( String  str  )  throws ParseException [static]

parse a String and convert it into an java.lang.Object

Parameters:
str the string to parse
Returns:
an Object represented by the string
Exceptions:
ParseException a parse exception is thrown if the string to parse does not follow the rigth format (see the description of this class)

Reimplemented in org.exolab.castor.types.GDay, org.exolab.castor.types.GMonth, org.exolab.castor.types.GMonthDay, org.exolab.castor.types.GYear, and org.exolab.castor.types.GYearMonth.

References org.exolab.castor.types.Date.parseDate().

Referenced by org.exolab.castor.types.Time.toDate(), and org.exolab.castor.types.RecurringDuration.toDate().

static Date org.exolab.castor.types.Date.parseDate ( String  str  )  throws ParseException [static]

parse a String and convert it into a Date.

Parameters:
str the string to parse
Returns:
the Date represented by the string
Exceptions:
ParseException a parse exception is thrown if the string to parse does not follow the rigth format (see the description of this class)

References org.exolab.castor.types.Date.Date().

Referenced by org.exolab.castor.types.Date.parse().

void org.exolab.castor.types.Date.setHour ( short  hour  ) 

set the hour field for this date/time type.

Parameters:
hour the hour to set
Exceptions:
OperationNotSupportedException this exception is thrown when changing the value of the hour field is not allowed

Reimplemented from org.exolab.castor.types.DateTimeBase.

void org.exolab.castor.types.Date.setMilliSecond ( short  millisecond  ) 

Sets the millisecond field for this date/time type

Parameters:
millsecond the millisecond to set
Exceptions:
OperationNotSupportedException this exception is thrown when changing the value of the second field is not allowed

Reimplemented from org.exolab.castor.types.DateTimeBase.

void org.exolab.castor.types.Date.setMinute ( short  minute  ) 

set the minute field for this date/time type.

Parameters:
minute the minute to set.
Exceptions:
OperationNotSupportedException this exception is thrown when changing the value of the minute field is not allowed

Reimplemented from org.exolab.castor.types.DateTimeBase.

void org.exolab.castor.types.Date.setSecond ( short  second  ) 

Sets the second field for this date/time type

Parameters:
second the second to set
Exceptions:
OperationNotSupportedException this exception is thrown when changing the value of the second field is not allowed

Reimplemented from org.exolab.castor.types.DateTimeBase.

void org.exolab.castor.types.Date.setValues ( short[]  values  )  [virtual]

Sets all the fields by reading the values in an array

if a Time Zone is specificied it has to be set by using setZone.

Parameters:
values an array of shorts with the values the array is supposed to be of length 4 and ordered like the following:

  • century
  • year
  • month
  • day

Implements org.exolab.castor.types.DateTimeBase.

Reimplemented in org.exolab.castor.types.GMonthDay, org.exolab.castor.types.GYear, and org.exolab.castor.types.GYearMonth.

References org.exolab.castor.types.DateTimeBase.setCentury(), org.exolab.castor.types.DateTimeBase.setDay(), org.exolab.castor.types.DateTimeBase.setMonth(), and org.exolab.castor.types.DateTimeBase.setYear().

Referenced by org.exolab.castor.types.Date.Date().


Member Data Documentation

final String org.exolab.castor.types.Date.DATE_FORMAT = "yyyy-MM-dd" [static]

The Date Format

Referenced by org.exolab.castor.types.Date.toDate().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties