public class OffsetTimestampGenerator extends java.lang.Object implements TimestampGenerator
AddTimestampMetadataService
.AddTimestampMetadataService
Constructor and Description |
---|
OffsetTimestampGenerator() |
OffsetTimestampGenerator(java.lang.String offset) |
Modifier and Type | Method and Description |
---|---|
java.util.Date |
generateTimestamp(AdaptrisMessage msg) |
java.lang.String |
getOffset() |
void |
setOffset(java.lang.String offset)
Set the offset for the timestamp.
|
public OffsetTimestampGenerator()
public OffsetTimestampGenerator(java.lang.String offset)
public java.util.Date generateTimestamp(AdaptrisMessage msg) throws ServiceException
generateTimestamp
in interface TimestampGenerator
ServiceException
public java.lang.String getOffset()
public void setOffset(java.lang.String offset)
The offset follows the ISO8601 convention for durations. The format is [+-]P[n]Y[n]M[n]DT[n]H[n]M[n]S. In these representations, the [n] is replaced by the value for each of the date and time elements that follow the [n]. Leading zeros are not required. The capital letters 'P', 'Y', 'M', 'W', 'D', 'T', 'H', 'M', and 'S' are designators for each of the date and time elements and are not replaced.
For example, P3Y6M4DT12H30M5S
represents a duration of three
years, six months, four days, twelve hours, thirty minutes, and five
seconds . Date and time elements including their designator may be omitted
if their value is zero, and lower order elements may also be omitted for
reduced precision. For example, "P23DT23H" and "P4Y" are both acceptable
duration representations.
To resolve ambiguity, "P1M" is a one-month duration and "PT1M" is a one-minute duration (note the time designator, T, that precedes the time value). The seconds value used may also have a decimal fraction, as in "PT0.5S" to indicate half a second."PT36H" could be used as well as "P1DT12H" for representing the same duration.
A negative period will become some date in the past; a positive or
unspecified period will resolve to some time in the future. For example
-P30D
will resolve to 30 days ago, whereas P30D
will resolve to 30 days in the future.
offset
- the offset.