
Package ca.uhn.fhir.model.primitive
Class InstantDt
java.lang.Object
ca.uhn.fhir.model.api.BaseElement
ca.uhn.fhir.model.api.BaseIdentifiableElement
ca.uhn.fhir.model.api.BasePrimitive<Date>
ca.uhn.fhir.model.primitive.BaseDateTimeDt
ca.uhn.fhir.model.primitive.InstantDt
- All Implemented Interfaces:
IDatatype,IElement,IIdentifiableElement,IPrimitiveDatatype<Date>,ISupportsUndeclaredExtensions,Externalizable,Serializable,IBase,IBaseDatatype,IPrimitiveType<Date>
Represents a FHIR instant datatype. Valid precisions values for this type are:
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TemporalPrecisionEnumThe default precision for this typeFields inherited from class ca.uhn.fhir.model.primitive.BaseDateTimeDt
NOW_DATE_CONSTANT, TODAY_DATE_CONSTANT -
Constructor Summary
ConstructorsConstructorDescriptionConstructor which creates an InstantDt with no timne value.InstantDt(BaseDateTimeDt theDateTime) Create a new DateTimeDt using an existing value.Create a new InstantDt from a string valueCreate a new DateTimeDtCreate a new DateTimeDt with the given date/time andTemporalPrecisionEnum.MILLIprecisionInstantDt(Date theDate, TemporalPrecisionEnum thePrecision) Constructor which accepts a date value and a precision value.InstantDt(Date theDate, TemporalPrecisionEnum thePrecision, TimeZone theTimezone) Create a new instance using the given date, precision level, and time zone -
Method Summary
Modifier and TypeMethodDescriptionbooleanInvokesDate.after(Date)on the contained Date against the given datebooleanInvokesDate.before(Date)on the contained Date against the given dateprotected TemporalPrecisionEnumReturns the default precision for this datatypeprotected booleanisPrecisionAllowed(TemporalPrecisionEnum thePrecision) To be implemented by subclasses to indicate whether the given precision is allowed by this typevoidSets the value of this instant to the current time (from the system clock) and the local/default timezone (as retrieved usingTimeZone.getDefault().static InstantDtFactory method which creates a new InstantDt with millisecond precision and initializes it with the current time and the system local timezone.Methods inherited from class ca.uhn.fhir.model.primitive.BaseDateTimeDt
encode, getDay, getHour, getMillis, getMinute, getMonth, getNanos, getPrecision, getSecond, getTimeZone, getValueAsCalendar, getYear, isTimeZoneZulu, isToday, parse, setDay, setHour, setMillis, setMinute, setMonth, setNanos, setPrecision, setSecond, setTimeZone, setTimeZoneZulu, setValue, setValue, setValueAsString, setYear, toHumanDisplay, toHumanDisplayLocalTimezoneMethods inherited from class ca.uhn.fhir.model.api.BasePrimitive
equals, getValue, getValueAsString, hashCode, hasValue, isEmpty, readExternal, toString, updateStringValue, writeExternalMethods inherited from class ca.uhn.fhir.model.api.BaseIdentifiableElement
getElementSpecificId, getId, setElementSpecificId, setId, setIdMethods inherited from class ca.uhn.fhir.model.api.BaseElement
addUndeclaredExtension, addUndeclaredExtension, addUndeclaredExtension, getAllUndeclaredExtensions, getFormatCommentsPost, getFormatCommentsPre, getUndeclaredExtensions, getUndeclaredExtensionsByUrl, getUndeclaredModifierExtensions, getUserData, hasFormatComment, isBaseEmpty, setUserDataMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.hl7.fhir.instance.model.api.IBase
fhirType, getFormatCommentsPost, getFormatCommentsPre, getUserData, hasFormatComment, setUserData
-
Field Details
-
DEFAULT_PRECISION
The default precision for this type
-
-
Constructor Details
-
InstantDt
public InstantDt()Constructor which creates an InstantDt with no timne value. Note that unlike the default constructor for the JavaDateorCalendarobjects, this constructor does not initialize the object with the current time.- See Also:
-
InstantDt
Create a new DateTimeDt -
InstantDt
Create a new instance using the given date, precision level, and time zone- Throws:
DataFormatException- If the specified precision is not allowed for this type
-
InstantDt
Create a new DateTimeDt using an existing value. Use this constructor with caution, as it may create more precision than warranted (since for example it is possible to pass in a DateTime with only a year, and this constructor will convert to an InstantDt with milliseconds precision). -
InstantDt
Create a new DateTimeDt with the given date/time andTemporalPrecisionEnum.MILLIprecision -
InstantDt
Constructor which accepts a date value and a precision value. Valid precisions values for this type are: -
InstantDt
Create a new InstantDt from a string value- Parameters:
theString- The string representation of the string. Must be in a valid format according to the FHIR specification- Throws:
DataFormatException
-
-
Method Details
-
after
InvokesDate.after(Date)on the contained Date against the given date- Throws:
NullPointerException- If thecontained Dateis null
-
before
InvokesDate.before(Date)on the contained Date against the given date- Throws:
NullPointerException- If thecontained Dateis null
-
setToCurrentTimeInLocalTimeZone
Sets the value of this instant to the current time (from the system clock) and the local/default timezone (as retrieved usingTimeZone.getDefault(). This TimeZone is generally obtained from the underlying OS. -
isPrecisionAllowed
Description copied from class:BaseDateTimeDtTo be implemented by subclasses to indicate whether the given precision is allowed by this type- Specified by:
isPrecisionAllowedin classBaseDateTimeDt
-
withCurrentTime
Factory method which creates a new InstantDt with millisecond precision and initializes it with the current time and the system local timezone. -
getDefaultPrecisionForDatatype
Returns the default precision for this datatype- Specified by:
getDefaultPrecisionForDatatypein classBaseDateTimeDt- See Also:
-