
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 TypeMethodDescriptionvoidadd(int theField, int theValue) Adds the given amount to the field specified by theFieldbooleanafter(DateTimeType theDateTimeType) booleanbefore(DateTimeType theDateTimeType) protected StringSubclasses must override to convert a "coerced" value into an encoded one.protected abstract ca.uhn.fhir.model.api.TemporalPrecisionEnumReturns the default precision for the given datatypeca.uhn.fhir.model.api.TemporalPrecisionEnumGets the precision for this datatype (using the default for the given type if not set)longgetTime()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) booleanbooleanisToday()Returnstrueif this object represents a date that is today's dateprotected DateSubclasses must override to convert an encoded representation of this datatype into a "coerced" onevoidsetOffsetMinutes(int theZoneOffsetMinutes) Sets the TimeZone offset in minutes relative to GMTvoidsetPrecision(ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision) Sets the precision for this datatype using field values fromCalendar.voidsetTimeZone(TimeZone theTimeZone) voidsetTimeZoneZulu(boolean theTimeZoneZulu) Sets the value of this date/time using the default level of precision for this datatype using the system local time zonevoidSets the value of this date/time using the specified level of precision using the system local time zonevoidsetValueAsString(String theString) protected voidsetValueAsV3String(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 necessary.Methods inherited from class org.hl7.fhir.dstu2.model.PrimitiveType
asStringValue, copy, equalsDeep, equalsShallow, fromStringValue, getValue, getValueAsString, hashCode, hasValue, isEmpty, isPrimitive, primitiveValue, toString, typedCopy, updateStringValueMethods 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, setPropertyMethods 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, setUserDataINNMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.hl7.fhir.instance.model.api.IBase
fhirType, getFormatCommentsPost, getFormatCommentsPre, getUserData, hasFormatComment, setUserDataMethods inherited from interface org.hl7.fhir.instance.model.api.IBaseElement
getUserData, setUserDataMethods 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:PrimitiveTypeSubclasses must override to convert a "coerced" value into an encoded one.- Specified by:
encodein 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 returnnullif no timezone was supplied. -
isTimeZoneZulu
-
isToday
Returnstrueif this object represents a date that is today's date- Throws:
NullPointerException- ifPrimitiveType.getValue()returnsnull
-
parse
Description copied from class:PrimitiveTypeSubclasses must override to convert an encoded representation of this datatype into a "coerced" one- Specified by:
parsein 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:
setValuein interfaceorg.hl7.fhir.instance.model.api.IPrimitiveType<Date>- Overrides:
setValuein 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:
setValueAsStringin interfaceorg.hl7.fhir.instance.model.api.IPrimitiveType<Date>- Overrides:
setValueAsStringin 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 necessary.- 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 fromCalendarsuch asCalendar.YEARtheValue- The number to add (or subtract for a negative number)
-
setValueAsV3String
-