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 enumThe enumeration of possible precisions. -
Constructor Summary
ConstructorsConstructorDescriptionHl7Dtm(@NonNull OffsetDateTime dateTime, @NonNull Hl7Dtm.Precision precision) Initializes aHl7Dtmobject with the given datetime and precision. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTwo HL7 timestamps are equal when they have the same values in the relevant fields (i.e.static Hl7DtmCreates aHl7Dtmobject from the given string.@NonNull OffsetDateTime@NonNull Hl7Dtm.PrecisioninthashCode()static Hl7Dtmnow()voidsetDateTime(@NonNull OffsetDateTime dateTime) voidsetPrecision(@NonNull Hl7Dtm.Precision precision) @NonNull StringtoHl7()@NonNull Instantstatic OffsetDateTimetoOffsetDateTime(@NonNull String s) Creates aOffsetDateTimeobject from the given string.toString()
-
Constructor Details
-
Hl7Dtm
Initializes aHl7Dtmobject with the given datetime and precision.
-
-
Method Details
-
fromHl7
Creates aHl7Dtmobject 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
Hl7Dtmobject. - Throws:
IllegalArgumentException- if the DTM string is invalid.
-
now
- Returns:
- a
Hl7Dtmwith the current date-time in second precision.
-
toOffsetDateTime
Creates aOffsetDateTimeobject 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
OffsetDateTimeobject, ornullif the parameter isnullor 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
-