Class Timestamp
java.lang.Object
org.openehealth.ipf.commons.ihe.xds.core.metadata.Timestamp
- All Implemented Interfaces:
Serializable
HL7 timestamps (data type DTM) with particular precision, normalized to UTC.
- Author:
- Dmytro Rud
- See Also:
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionTimestamp
(ZonedDateTime dateTime, Timestamp.Precision precision) Initializes aTimestamp
object with the given datetime and precision. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Two HL7 timestamps are equal when they have the same values in the relevant fields (i.e.static Timestamp
Creates aTimestamp
object from the given string.Timestamp.int
hashCode()
static Timestamp
now()
void
setDateTime
(ZonedDateTime dateTime) void
setPrecision
(Timestamp.Precision precision) Precision of the timestamp (smallest present element, e.g.toHL7()
static String
Returns a HL7 representation of the given timestamp, considering the precision.toString()
-
Constructor Details
-
Timestamp
public Timestamp() -
Timestamp
Initializes aTimestamp
object with the given datetime and precision.
-
-
Method Details
-
fromHL7
Creates aTimestamp
object from the given string.- Parameters:
s
- String of the patternYYYY[MM[DD[HH[MM[SS[.S[S[S[S]]]]]]]]][+/-ZZZZ]
. Milliseconds will be ignored.- Returns:
- a
Timestamp
object, ornull
if the parameter isnull
or empty.
-
toHL7
Returns a HL7 representation of the given timestamp, considering the precision.- Parameters:
timestamp
-Timestamp
object, can benull
.- Returns:
- HL7 representation of the timestamp, or
null
if the parameter isnull
.
-
toHL7
-
setDateTime
-
getPrecision
-
now
- Returns:
- a
Timestamp
with the current date-time in second precision.
-
equals
Two HL7 timestamps are equal when they have the same values in the relevant fields (i.e. in the ones covered by the precision). -
hashCode
public int hashCode() -
toString
-
getDateTime
Timestamp. -
setPrecision
Precision of the timestamp (smallest present element, e.g. YEAR for "1980").
-