
Package org.hl7.fhir.dstu2.model
Class BaseDateTimeType
java.lang.Object
- All Implemented Interfaces:
ca.uhn.fhir.model.api.IElement
,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>
- Direct Known Subclasses:
DateTimeType
,DateType
,InstantType
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionConstructorBaseDateTimeType
(String theString) ConstructorBaseDateTimeType
(Date theDate, ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision) ConstructorBaseDateTimeType
(Date theDate, ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision, TimeZone theTimeZone) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(int theField, int theValue) Adds the given amount to the field specified by theFieldboolean
after
(DateTimeType theDateTimeType) boolean
before
(DateTimeType theDateTimeType) protected String
Subclasses must override to convert a "coerced" value into an encoded one.protected abstract ca.uhn.fhir.model.api.TemporalPrecisionEnum
Returns the default precision for the given datatypeca.uhn.fhir.model.api.TemporalPrecisionEnum
Gets the precision for this datatype (using the default for the given type if not set)long
getTime()
Returns the time in millis as represented by this Date/TimeReturns the TimeZone associated with this dateTime's value.getValueAsString
(ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision) boolean
boolean
isToday()
Returnstrue
if this object represents a date that is today's dateprotected Date
Subclasses must override to convert an encoded representation of this datatype into a "coerced" onevoid
setOffsetMinutes
(int theZoneOffsetMinutes) Sets the TimeZone offset in minutes relative to GMTvoid
setPrecision
(ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision) Sets the precision for this datatype using field values fromCalendar
.void
setTimeZone
(TimeZone theTimeZone) void
setTimeZoneZulu
(boolean theTimeZoneZulu) Sets the value of this date/time using the default level of precision for this datatype using the system local time zonevoid
Sets the value of this date/time using the specified level of precision using the system local time zonevoid
setValueAsString
(String theString) protected void
setValueAsV3String
(String theV3String) Returns a view of this date/time as a Calendar objectReturns a human readable version of this date/time using the system local format.Returns a human readable version of this date/time using the system local format, converted to the local timezone if neccesary.Methods inherited from class org.hl7.fhir.dstu2.model.PrimitiveType
asStringValue, copy, equalsDeep, equalsShallow, fromStringValue, getValue, getValueAsString, hashCode, hasValue, isEmpty, isPrimitive, primitiveValue, toString, typedCopy, updateStringValue
Methods inherited from class org.hl7.fhir.dstu2.model.Element
addChild, addExtension, addExtension, addExtension, copyValues, fhirType, getExtension, getExtensionByUrl, getExtensionsByUrl, getExtensionString, getId, getIdElement, hasExtension, hasExtension, hasId, hasIdElement, listChildren, setId, setIdElement, setProperty
Methods inherited from class org.hl7.fhir.dstu2.model.Base
castToAddress, castToAnnotation, castToAttachment, castToBase64Binary, castToBoolean, castToCode, castToCodeableConcept, castToCoding, castToContactPoint, castToDate, castToDateTime, castToDecimal, castToDuration, castToElementDefinition, castToExtension, castToHumanName, castToId, castToIdentifier, castToInstant, castToInteger, castToMarkdown, castToMeta, castToMoney, castToNarrative, castToOid, castToPeriod, castToPositiveInt, castToQuantity, castToRange, castToRatio, castToReference, castToResource, castToSampledData, castToSignature, castToSimpleQuantity, castToString, castToTime, castToTiming, castToUnsignedInt, castToUri, children, compareDeep, compareDeep, compareDeep, compareValues, compareValues, equals, getChildByName, getFormatCommentsPost, getFormatCommentsPre, getUserData, getUserInt, getUserString, hasFormatComment, hasType, hasUserData, isMetadataBased, 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
fhirType, getFormatCommentsPost, getFormatCommentsPre, getUserData, hasFormatComment, setUserData
Methods inherited from interface org.hl7.fhir.instance.model.api.IBaseElement
getUserData, setUserData
Methods inherited from interface org.hl7.fhir.instance.model.api.IBaseHasExtensions
addExtension, getExtension, hasExtension
-
Constructor Details
-
BaseDateTimeType
public BaseDateTimeType()Constructor -
BaseDateTimeType
Constructor- Throws:
IllegalArgumentException
- If the specified precision is not allowed for this type
-
BaseDateTimeType
Constructor- Throws:
IllegalArgumentException
- If the specified precision is not allowed for this type
-
BaseDateTimeType
public BaseDateTimeType(Date theDate, ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision, TimeZone theTimeZone) Constructor
-
-
Method Details
-
getValueAsString
- Parameters:
thePrecision
-- Returns:
- the String value of this instance with the specified precision.
-
encode
Description copied from class:PrimitiveType
Subclasses must override to convert a "coerced" value into an encoded one.- Specified by:
encode
in classPrimitiveType<Date>
- Parameters:
theValue
- Will not be null- Returns:
- May return null if the value does not correspond to anything
-
getDefaultPrecisionForDatatype
Returns the default precision for the given datatype -
getPrecision
Gets the precision for this datatype (using the default for the given type if not set)- See Also:
-
getTimeZone
Returns the TimeZone associated with this dateTime's value. May returnnull
if no timezone was supplied. -
isTimeZoneZulu
-
isToday
Returnstrue
if this object represents a date that is today's date- Throws:
NullPointerException
- ifPrimitiveType.getValue()
returnsnull
-
parse
Description copied from class:PrimitiveType
Subclasses must override to convert an encoded representation of this datatype into a "coerced" one- Specified by:
parse
in classPrimitiveType<Date>
- Parameters:
theValue
- Will not be null- Returns:
- May return null if the value does not correspond to anything
- Throws:
IllegalArgumentException
-
setPrecision
public void setPrecision(ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision) throws IllegalArgumentException Sets the precision for this datatype using field values fromCalendar
. Valid values are:- Throws:
IllegalArgumentException
-
setTimeZone
-
setTimeZoneZulu
-
setValue
Sets the value of this date/time using the default level of precision for this datatype using the system local time zone- Specified by:
setValue
in interfaceorg.hl7.fhir.instance.model.api.IPrimitiveType<Date>
- Overrides:
setValue
in classPrimitiveType<Date>
- Parameters:
theValue
- The date value
-
setValue
public void setValue(Date theValue, ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision) throws IllegalArgumentException Sets the value of this date/time using the specified level of precision using the system local time zone- Parameters:
theValue
- The date valuethePrecision
- The precision- Throws:
IllegalArgumentException
-
setValueAsString
- Specified by:
setValueAsString
in interfaceorg.hl7.fhir.instance.model.api.IPrimitiveType<Date>
- Overrides:
setValueAsString
in classPrimitiveType<Date>
- Throws:
IllegalArgumentException
-
before
-
after
-
toHumanDisplay
Returns a human readable version of this date/time using the system local format.Note on time zones: This method renders the value using the time zone that is contained within the value. For example, if this date object contains the value "2012-01-05T12:00:00-08:00", the human display will be rendered as "12:00:00" even if the application is being executed on a system in a different time zone. If this behaviour is not what you want, use
toHumanDisplayLocalTimezone()
instead. -
toHumanDisplayLocalTimezone
Returns a human readable version of this date/time using the system local format, converted to the local timezone if neccesary.- See Also:
-
toCalendar
Returns a view of this date/time as a Calendar object -
setOffsetMinutes
Sets the TimeZone offset in minutes relative to GMT -
getTime
Returns the time in millis as represented by this Date/Time -
add
Adds the given amount to the field specified by theField- Parameters:
theField
- The field, uses constants fromCalendar
such asCalendar.YEAR
theValue
- The number to add (or subtract for a negative number)
-
setValueAsV3String
-