Class Hl7Dtm
java.lang.Object
org.projecthusky.common.utils.time.Hl7Dtm
HL7 timestamps (data type DTM) with particular precision, normalized to UTC.
Original code from IPF (https://github.com/oehf/ipf) under Apache 2.0 licence.
- Author:
- Dmytro Rud
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
The enumeration of possible precisions. -
Constructor Summary
ConstructorsConstructorDescriptionHl7Dtm
(@NonNull OffsetDateTime dateTime, @NonNull Hl7Dtm.Precision precision) Initializes aHl7Dtm
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 Hl7Dtm
Creates aHl7Dtm
object from the given string.@NonNull OffsetDateTime
@NonNull Hl7Dtm.Precision
int
hashCode()
static Hl7Dtm
now()
void
setDateTime
(@NonNull OffsetDateTime dateTime) void
setPrecision
(@NonNull Hl7Dtm.Precision precision) @NonNull String
toHl7()
@NonNull Instant
static OffsetDateTime
toOffsetDateTime
(@NonNull String s) Creates aOffsetDateTime
object from the given string.toString()
-
Constructor Details
-
Hl7Dtm
Initializes aHl7Dtm
object with the given datetime and precision.
-
-
Method Details
-
fromHl7
Creates aHl7Dtm
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
Hl7Dtm
object. - Throws:
IllegalArgumentException
- if the DTM string is invalid.
-
now
- Returns:
- a
Hl7Dtm
with the current date-time in second precision.
-
toOffsetDateTime
Creates aOffsetDateTime
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
OffsetDateTime
object, ornull
if the parameter isnull
or empty. - Throws:
IllegalArgumentException
- if the DTM string is invalid.
-
setDateTime
-
getDateTime
-
setPrecision
-
getPrecision
-
toInstant
-
toHl7
-
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
-