Package org.hl7.fhir.r4.model
Class InstantType
- java.lang.Object
-
- org.hl7.fhir.r4.model.Base
-
- org.hl7.fhir.r4.model.Element
-
- org.hl7.fhir.r4.model.Type
-
- org.hl7.fhir.r4.model.PrimitiveType<Date>
-
- org.hl7.fhir.r4.model.BaseDateTimeType
-
- org.hl7.fhir.r4.model.InstantType
-
- All Implemented Interfaces:
ca.uhn.fhir.model.api.IElement,Externalizable,Serializable,org.hl7.fhir.instance.model.api.IBase,org.hl7.fhir.instance.model.api.IBaseDatatype,org.hl7.fhir.instance.model.api.IBaseElement,org.hl7.fhir.instance.model.api.IBaseHasExtensions,org.hl7.fhir.instance.model.api.IPrimitiveType<Date>
public class InstantType extends BaseDateTimeType
Represents a FHIR instant datatype. Valid precisions values for this type are:TemporalPrecisionEnum.SECONDTemporalPrecisionEnum.MILLI
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static ca.uhn.fhir.model.api.TemporalPrecisionEnumDEFAULT_PRECISIONThe default precision for this type
-
Constructor Summary
Constructors Constructor Description InstantType()Constructor which creates an InstantDt with no timne value.InstantType(String theString)Create a new InstantDt from a string valueInstantType(Calendar theCalendar)Create a new DateTimeDtInstantType(Date theDate)Create a new DateTimeDt with the given date/time andTemporalPrecisionEnum.MILLIprecisionInstantType(Date theDate, ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision)Constructor which accepts a date value and a precision value.InstantType(Date theDate, ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision, TimeZone theTimezone)Create a new instance using the given date, precision level, and time zoneInstantType(BaseDateTimeType theDateTime)Create a new DateTimeDt using an existing value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanafter(Date theDate)InvokesDate.after(Date)on the contained Date against the given datebooleanbefore(Date theDate)InvokesDate.before(Date)on the contained Date against the given dateInstantTypecopy()StringfhirType()protected ca.uhn.fhir.model.api.TemporalPrecisionEnumgetDefaultPrecisionForDatatype()Returns the default precision for this datatypestatic InstantTypenow()Returns a new instance of DateTimeType with the current system time and MILLI precision and the system local time zonestatic InstantTypeparseV3(String theV3String)Creates a new instance by parsing an HL7 v3 format date time stringvoidsetToCurrentTimeInLocalTimeZone()Sets the value of this instant to the current time (from the system clock) and the local/default timezone (as retrieved usingTimeZone.getDefault().static InstantTypewithCurrentTime()Factory 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 org.hl7.fhir.r4.model.BaseDateTimeType
add, after, before, dateTimeValue, encode, equalsUsingFhirPathRules, getDay, getHour, getMillis, getMinute, getMonth, getNanos, getPrecision, getSecond, getTimeZone, getValueAsCalendar, getYear, hasTime, isDateTime, isTimeZoneZulu, isToday, parse, setDay, setHour, setMillis, setMinute, setMonth, setNanos, setPrecision, setSecond, setTimeZone, setTimeZoneZulu, setValue, setValue, setValueAsString, setValueAsV3String, setYear, toCalendar, toHumanDisplay, toHumanDisplayLocalTimezone
-
Methods inherited from class org.hl7.fhir.r4.model.PrimitiveType
asStringValue, equalsDeep, equalsShallow, forceStringValue, fromStringValue, getProperty, getTypesForProperty, getValue, getValueAsString, hashCode, hasPrimitiveValue, hasValue, isEmpty, isPrimitive, makeProperty, primitiveValue, readExternal, setProperty, setProperty, toString, typedCopy, updateStringValue, writeExternal
-
Methods inherited from class org.hl7.fhir.r4.model.Element
addChild, addExtension, addExtension, addExtension, copyValues, getExtension, getExtensionByUrl, getExtensionFirstRep, getExtensionsByUrl, getExtensionString, getId, getIdBase, getIdElement, getNamedProperty, hasExtension, hasExtension, hasId, hasIdElement, isDisallowExtensions, listChildren, noExtensions, removeExtension, setDisallowExtensions, setExtension, setId, setIdBase, setIdElement
-
Methods inherited from class org.hl7.fhir.r4.model.Base
castToAddress, castToAnnotation, castToAttachment, castToBase64Binary, castToBoolean, castToCanonical, castToCode, castToCodeableConcept, castToCoding, castToContactDetail, castToContactPoint, castToContributor, castToDataRequirement, castToDate, castToDateTime, castToDecimal, castToDosage, castToDuration, castToElementDefinition, castToExpression, castToExtension, castToHumanName, castToId, castToIdentifier, castToInstant, castToInteger, castToMarkdown, castToMarketingStatus, castToMeta, castToMoney, castToNarrative, castToOid, castToParameterDefinition, castToPeriod, castToPopulation, castToPositiveInt, castToProdCharacteristic, castToProductShelfLife, castToQuantity, castToRange, castToRatio, castToReference, castToRelatedArtifact, castToResource, castToSampledData, castToSignature, castToSimpleQuantity, castToString, castToSubstanceAmount, castToTime, castToTiming, castToTriggerDefinition, castToType, castToUnsignedInt, castToUri, castToUrl, castToUsageContext, castToXhtml, castToXhtmlString, children, clearUserData, compareDeep, compareDeep, compareDeep, compareDeep, compareValues, compareValues, equals, getChildByName, getFormatCommentsPost, getFormatCommentsPre, getNamedProperty, getUserData, getUserInt, getUserString, hasFormatComment, hasType, hasUserData, isBooleanPrimitive, isMetadataBased, isResource, listChildrenByName, listChildrenByName, setUserData, setUserDataINN
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hl7.fhir.instance.model.api.IBase
getFormatCommentsPost, getFormatCommentsPre, getUserData, hasFormatComment, setUserData
-
-
-
-
Field Detail
-
DEFAULT_PRECISION
public static final ca.uhn.fhir.model.api.TemporalPrecisionEnum DEFAULT_PRECISION
The default precision for this type
-
-
Constructor Detail
-
InstantType
public InstantType()
-
InstantType
public InstantType(Calendar theCalendar)
Create a new DateTimeDt
-
InstantType
public InstantType(Date theDate, ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision, TimeZone theTimezone)
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
-
InstantType
public InstantType(BaseDateTimeType theDateTime)
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).
-
InstantType
public InstantType(Date theDate)
Create a new DateTimeDt with the given date/time andTemporalPrecisionEnum.MILLIprecision
-
InstantType
public InstantType(Date theDate, ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision)
Constructor which accepts a date value and a precision value. Valid precisions values for this type are:TemporalPrecisionEnum.SECONDTemporalPrecisionEnum.MILLI
-
InstantType
public InstantType(String theString)
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 Detail
-
after
public boolean after(Date theDate)
InvokesDate.after(Date)on the contained Date against the given date- Throws:
NullPointerException- If thecontained Dateis null
-
before
public boolean before(Date theDate)
InvokesDate.before(Date)on the contained Date against the given date- Throws:
NullPointerException- If thecontained Dateis null
-
setToCurrentTimeInLocalTimeZone
public void 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.
-
withCurrentTime
public static InstantType withCurrentTime()
Factory method which creates a new InstantDt with millisecond precision and initializes it with the current time and the system local timezone.
-
getDefaultPrecisionForDatatype
protected ca.uhn.fhir.model.api.TemporalPrecisionEnum getDefaultPrecisionForDatatype()
Returns the default precision for this datatype- Specified by:
getDefaultPrecisionForDatatypein classBaseDateTimeType- See Also:
DEFAULT_PRECISION
-
copy
public InstantType copy()
- Specified by:
copyin classPrimitiveType<Date>
-
now
public static InstantType now()
Returns a new instance of DateTimeType with the current system time and MILLI precision and the system local time zone
-
parseV3
public static InstantType parseV3(String theV3String)
Creates a new instance by parsing an HL7 v3 format date time string
-
-