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

org.exolab.castor.types.DateTimeBase Class Reference

Inheritance diagram for org.exolab.castor.types.DateTimeBase:
org.exolab.castor.types.Date org.exolab.castor.types.Time 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

void setCentury (short century)
void setYear (short year) throws OperationNotSupportedException
void setMonth (short month) throws OperationNotSupportedException
void setDay (short day) throws OperationNotSupportedException
final boolean isLeap (int year)
void setHour (short hour) throws OperationNotSupportedException
void setMinute (short minute) throws OperationNotSupportedException
void setSecond (short second, short millsecond) throws OperationNotSupportedException
void setSecond (short second) throws OperationNotSupportedException
void setMilliSecond (short millisecond) throws OperationNotSupportedException
void setZone (short hour, short minute) throws OperationNotSupportedException
void setZoneHour (short hour) throws OperationNotSupportedException
void setZoneMinute (short minute) throws OperationNotSupportedException
abstract void setValues (short[] values)
void setNegative ()
abstract Date toDate ()
void setZoneNegative (boolean zoneNegative) throws OperationNotSupportedException
void setUTC ()
short getCentury ()
short getYear ()
short getMonth ()
short getDay ()
short getHour ()
short getMinute ()
short getSeconds ()
short getMilli ()
short getZoneHour ()
short getZoneMinute ()
abstract short[] getValues ()
boolean isUTC ()
boolean isNegative ()
boolean isZoneNegative ()
void addDuration (Duration duration)
void normalize ()
int compareTo (DateTimeBase dateTime)
int hashCode ()
boolean equals (Object object)
Calendar toCalendar ()

Static Public Attributes

static final int INDETERMINATE = -1
static final int LESS_THAN = 0
static final int EQUALS = 1
static final int GREATER_THAN = 2

Protected Member Functions

boolean equal (DateTimeBase dateTime)

Static Protected Attributes

static final String WRONGLY_PLACED = "is wrongly placed."

Detailed Description

The base class for date/time XML Schema types.

The validation of the date/time fields is done in the set methods and follows the ISO8601 Date and Time Format.

Note: the castor date/time type are mutable, unlike the date/time types of the JDK in Java2. This is needed by the Marshalling framework.

Author:
Arnaud Blandin
Version:
Revision:
1.1.1.1
See also:
Date
Time

Member Function Documentation

int org.exolab.castor.types.DateTimeBase.compareTo ( DateTimeBase  dateTime  ) 

Compares two date/time data types. The algorithm of comparison is defined in W3C XML Schema Recommendation (section 3.2.7.3)

The returned values can be:

  • INDETERMINATE (-1): this ? dateTime
  • LESS_THAN (0): this < dateTime
  • EQUALS (1): this == dateTime
  • GREATER_THAN (2): this > dateTime
Parameters:
dateTime the dateTime to compare with the current instance.
Returns:
  • INDETERMINATE (-1)
  • LESS_THAN (0)
  • EQUALS (1)
  • GREATER_THAN (2)

References org.exolab.castor.types.DateTimeBase.GREATER_THAN, org.exolab.castor.types.DateTimeBase.INDETERMINATE, org.exolab.castor.types.DateTimeBase.isUTC(), org.exolab.castor.types.DateTimeBase.LESS_THAN, org.exolab.castor.types.DateTimeBase.normalize(), org.exolab.castor.types.DateTimeBase.setZone(), and org.exolab.castor.types.DateTimeBase.setZoneNegative().

Referenced by org.exolab.castor.types.DateTimeBase.equal().

boolean org.exolab.castor.types.DateTimeBase.equal ( DateTimeBase  dateTime  )  [protected]

Returns true if the present instance of date/time type is equal to the parameter.

The equals relation is as defined in the W3C XML Schema Recommendation, part2.

Parameters:
dateTime the date/time type to compare with the present instance
Returns:
true if the present instance is equal to the parameter false if not

References org.exolab.castor.types.DateTimeBase.compareTo(), and org.exolab.castor.types.DateTimeBase.EQUALS.

Referenced by org.exolab.castor.types.DateTimeBase.equals().

boolean org.exolab.castor.types.DateTimeBase.equals ( Object  object  ) 

Overrides the java.lang.Object.equals method

See also:
equal

References org.exolab.castor.types.DateTimeBase.equal().

abstract short [] org.exolab.castor.types.DateTimeBase.getValues (  )  [pure virtual]

returns an array of short with all the fields that describe a date/time type.

Returns:
an array of short with all the fields that describe a date/time type.

Implemented in org.exolab.castor.types.Date, org.exolab.castor.types.GMonthDay, org.exolab.castor.types.GYear, org.exolab.castor.types.GYearMonth, and org.exolab.castor.types.Time.

int org.exolab.castor.types.DateTimeBase.hashCode (  ) 

Overrides the java.lang.Object.hashcode method.

final boolean org.exolab.castor.types.DateTimeBase.isLeap ( int  year  ) 

Returns true if the given year represents a leap year A specific year is a leap year if it is either evenly divisible by 400 OR evenly divisible by 4 and not evenly divisible by 100

Parameters:
year the year to test.
Returns:
true if the given year represents a leap year

Referenced by org.exolab.castor.types.DateTimeBase.setDay().

void org.exolab.castor.types.DateTimeBase.normalize (  ) 
void org.exolab.castor.types.DateTimeBase.setHour ( short  hour  )  throws OperationNotSupportedException

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 in org.exolab.castor.types.Date.

Referenced by org.exolab.castor.types.DateTimeBase.addDuration(), org.exolab.castor.types.TimeDescriptor.TimeFieldHandler.setValue(), org.exolab.castor.types.Time.setValues(), and org.exolab.castor.types.Time.Time().

void org.exolab.castor.types.DateTimeBase.setMilliSecond ( short  millisecond  )  throws OperationNotSupportedException

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 in org.exolab.castor.types.Date.

Referenced by org.exolab.castor.types.DateTimeBase.setSecond().

void org.exolab.castor.types.DateTimeBase.setMinute ( short  minute  )  throws OperationNotSupportedException

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 in org.exolab.castor.types.Date.

Referenced by org.exolab.castor.types.DateTimeBase.addDuration(), org.exolab.castor.types.TimeDescriptor.TimeFieldHandler.setValue(), org.exolab.castor.types.Time.setValues(), and org.exolab.castor.types.Time.Time().

void org.exolab.castor.types.DateTimeBase.setNegative (  ) 

set the negative field to true

Reimplemented in org.exolab.castor.types.GMonthDay.

void org.exolab.castor.types.DateTimeBase.setSecond ( short  second,
short  millsecond 
) throws OperationNotSupportedException

set the second field for this date/time type

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

References org.exolab.castor.types.DateTimeBase.setMilliSecond().

Referenced by org.exolab.castor.types.DateTimeBase.addDuration(), org.exolab.castor.types.TimeDescriptor.TimeFieldHandler.setValue(), org.exolab.castor.types.Time.setValues(), and org.exolab.castor.types.Time.Time().

void org.exolab.castor.types.DateTimeBase.setSecond ( short  second  )  throws OperationNotSupportedException

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 in org.exolab.castor.types.Date.

abstract void org.exolab.castor.types.DateTimeBase.setValues ( short[]  values  )  [pure virtual]

Sets all the fields by reading the values in an array

Parameters:
values an array of shorts with the values

Implemented in org.exolab.castor.types.Date, org.exolab.castor.types.GMonthDay, org.exolab.castor.types.GYear, org.exolab.castor.types.GYearMonth, and org.exolab.castor.types.Time.

void org.exolab.castor.types.DateTimeBase.setZoneHour ( short  hour  )  throws OperationNotSupportedException

Sets the time zone hour field for this date/time type. A call to this method means that the date/time type used is UTC.

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

References org.exolab.castor.types.DateTimeBase.setUTC().

Referenced by org.exolab.castor.types.DateTimeBase.setZone().

void org.exolab.castor.types.DateTimeBase.setZoneMinute ( short  minute  )  throws OperationNotSupportedException

Sets the time zone minute field for this date/time type. A call to this method means that the date/time type used is UTC.

Parameters:
minute the time zone minute to set
Exceptions:
OperationNotSupportedException this exception is thrown when changing the value of the time zone fields is not allowed

References org.exolab.castor.types.DateTimeBase.setUTC().

Referenced by org.exolab.castor.types.DateTimeBase.setZone().

void org.exolab.castor.types.DateTimeBase.setZoneNegative ( boolean  zoneNegative  )  throws OperationNotSupportedException

set the time zone negative field to true

Exceptions:
OperationNotSupportedException this exception is thrown when changing the time zone fields is not allowed

Referenced by org.exolab.castor.types.DateTimeBase.compareTo(), and org.exolab.castor.types.DateDescriptor.DateFieldHandler.setValue().

Calendar org.exolab.castor.types.DateTimeBase.toCalendar (  ) 

converts this Date/Time into a local java Calendar.

Returns:
a local calendar representing this Date or Time

References org.exolab.castor.types.DateTimeBase.toDate().

abstract Date org.exolab.castor.types.DateTimeBase.toDate (  )  [pure virtual]

Member Data Documentation

Fields used for comparison methods

Referenced by org.exolab.castor.types.DateTimeBase.compareTo().

final String org.exolab.castor.types.DateTimeBase.WRONGLY_PLACED = "is wrongly placed." [static, protected]

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