com.ibm.websphere.sib.wsn

Class AbsoluteOrRelativeTime

  1. java.lang.Object
  2. extended bycom.ibm.websphere.sib.wsn.AbsoluteOrRelativeTime

  1. public class AbsoluteOrRelativeTime
  2. 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

Constructor and Description
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

Modifier and Type Method and Description
  1. java.util.Calendar
getAbsoluteTime()
  1. java.lang.String
getRelativeTime()
  1. void
setDateTime(java.util.Calendar absoluteTime)
Set the absolute time value.
  1. 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

  1. 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

  1. 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:
  • P is a required value to inidicate the start of the expression
  • xY indicates the number of years (optional)
  • xM indicates the number of months (optional)
  • xD indicates the number of days (optional)
  • T indicates the start of a time section and is required if the duration expressed contains hours, minutes, or seconds
  • xH indicates the number of hours (optional)
  • xM indicates the number of minutes (optional)
  • xS indicates the number of seconds (optional)

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

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

setDateTime

  1. 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

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

setRelativeTime

  1. 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)