com.ibm.websphere.sib.wsn
Class AbsoluteOrRelativeTime
- java.lang.Object
com.ibm.websphere.sib.wsn.AbsoluteOrRelativeTime
- public class AbsoluteOrRelativeTime
- extends java.lang.Object
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 |
---|---|
|
getAbsoluteTime()
|
|
getRelativeTime()
|
|
setDateTime(java.util.Calendar absoluteTime)
Set the absolute time value.
|
|
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
- 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
- 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)