IBM WebSphere Application ServerTM
Release 7

com.ibm.websphere.sib.wsn
Class AbsoluteOrRelativeTime

java.lang.Object
  extended by com.ibm.websphere.sib.wsn.AbsoluteOrRelativeTime

public class AbsoluteOrRelativeTime
extends java.lang.Object

This class represents the AbsoluteOrRelativeTime type defined in the WS-Notification Base Notification schema. It acts as a holder for either a Calendar (xsd:dataTime) or String (xsd:duration). Only one of these time values can be non null at any one time.


Constructor Summary
AbsoluteOrRelativeTime(java.util.Calendar absoluteTime)
          Constructor which takes an absolute time value.
AbsoluteOrRelativeTime(java.lang.String relativeTime)
          Constructor which takes a relative time value.
 
Method Summary
 java.util.Calendar getAbsoluteTime()
           
 java.lang.String getRelativeTime()
           
 void setDateTime(java.util.Calendar absoluteTime)
          Set the absolute time value.
 void setRelativeTime(java.lang.String relativeTime)
          Set the relative time value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbsoluteOrRelativeTime

public AbsoluteOrRelativeTime(java.util.Calendar absoluteTime)
Constructor which takes an absolute time value. This value cannot be null.

Parameters:
absoluteTime - The absolute time value
Throws:
java.lang.IllegalArgumentException - Thrown if the argument is null

AbsoluteOrRelativeTime

public AbsoluteOrRelativeTime(java.lang.String relativeTime)
Constructor which takes a relative time value. The time value is expressed as String with the following format PxYxMxDTxHxMxS where:
Examples:
"P12Y8M22DT3H35M2S" indicates a duration of 12 years, 8 months, 22 days, 3 hours, 35 minutes and 2 seconds
"P21DT8H" indicates a duration of 21 days and 8 hours
"P5Y7M" indicates a duration of 5 years and 7 months
"PT14S" indicates a duration of 14 seconds

Parameters:
relativeTime - The relative time value.
Throws:
java.lang.IllegalArgumentException - Thrown if the argument is null
Method Detail

getAbsoluteTime

public java.util.Calendar getAbsoluteTime()
Returns:
The absolute time value or null if not set or a relative time value has been set

setDateTime

public void setDateTime(java.util.Calendar absoluteTime)
Set the absolute time value. A value of null will be ignored. Setting a non null value will result in the relative time value being set to null.

Parameters:
absoluteTime - The absolute time value.

getRelativeTime

public java.lang.String getRelativeTime()
Returns:
The relative time or null if not set or an absolute time has been set

setRelativeTime

public void setRelativeTime(java.lang.String relativeTime)
Set the relative time value. A value of null will be ignored. Setting a non null value will result in the absolute time value being set to null.

Parameters:
relativeTime - The relative time value. For the format of the string see AbsoluteOrRelativeTime(String)

IBM WebSphere Application ServerTM
Release 7