public abstract class BaseDateTimeType extends PrimitiveType<Date>
| Constructor and Description |
|---|
BaseDateTimeType()
Constructor
|
BaseDateTimeType(Date theDate,
ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision)
Constructor
|
BaseDateTimeType(Date theDate,
ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision,
TimeZone theTimeZone)
Constructor
|
BaseDateTimeType(String theString)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int theField,
int theValue)
Adds the given amount to the field specified by theField
|
boolean |
after(DateTimeType theDateTimeType)
Returns
true if the given object represents a date/time before this object |
boolean |
before(DateTimeType theDateTimeType)
Returns
true if the given object represents a date/time before this object |
BaseDateTimeType |
dateTimeValue() |
protected String |
encode(Date theValue)
Subclasses must override to convert a "coerced" value into an encoded one.
|
Boolean |
equalsUsingFhirPathRules(BaseDateTimeType theOther)
This method implements a datetime equality check using the rules as defined by FHIRPath.
|
String |
fpValue() |
Integer |
getDay()
Returns the month with 1-index, e.g.
|
protected abstract ca.uhn.fhir.model.api.TemporalPrecisionEnum |
getDefaultPrecisionForDatatype()
Returns the default precision for the given datatype
|
Integer |
getHour()
Returns the hour of the day in a 24h clock, e.g.
|
Integer |
getMillis()
Returns the milliseconds within the current second.
|
Integer |
getMinute()
Returns the minute of the hour in the range 0-59
|
Integer |
getMonth()
Returns the month with 0-index, e.g.
|
Long |
getNanos()
Returns the nanoseconds within the current second
|
ca.uhn.fhir.model.api.TemporalPrecisionEnum |
getPrecision()
Gets the precision for this datatype (using the default for the given type if not set)
|
Integer |
getSecond()
Returns the second of the minute in the range 0-59
|
TimeZone |
getTimeZone()
Returns the TimeZone associated with this dateTime's value.
|
GregorianCalendar |
getValueAsCalendar()
Returns the value of this object as a
GregorianCalendar |
Integer |
getYear()
Returns the year, e.g.
|
boolean |
hasTime() |
boolean |
isDateTime() |
boolean |
isTimeZoneZulu()
Returns true if the timezone is set to GMT-0:00 (Z)
|
boolean |
isToday()
Returns
true if this object represents a date that is today's date |
protected Date |
parse(String theValue)
Subclasses must override to convert an encoded representation of this datatype into a "coerced" one
|
BaseDateTimeType |
setDay(int theDay)
Sets the month with 1-index, e.g.
|
BaseDateTimeType |
setHour(int theHour)
Sets the hour of the day in a 24h clock, e.g.
|
BaseDateTimeType |
setMillis(int theMillis)
Sets the milliseconds within the current second.
|
BaseDateTimeType |
setMinute(int theMinute)
Sets the minute of the hour in the range 0-59
|
BaseDateTimeType |
setMonth(int theMonth)
Sets the month with 0-index, e.g.
|
BaseDateTimeType |
setNanos(long theNanos)
Sets the nanoseconds within the current second
|
void |
setPrecision(ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision)
Sets the precision for this datatype
|
BaseDateTimeType |
setSecond(int theSecond)
Sets the second of the minute in the range 0-59
|
BaseDateTimeType |
setTimeZone(TimeZone theTimeZone) |
BaseDateTimeType |
setTimeZoneZulu(boolean theTimeZoneZulu) |
BaseDateTimeType |
setValue(Date theValue)
Sets the value for this type using the given Java Date object as the time, and using the default precision for
this datatype (unless the precision is already set), as well as the local timezone as determined by the local operating
system.
|
void |
setValue(Date theValue,
ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision)
Sets the value for this type using the given Java Date object as the time, and using the specified precision, as
well as the local timezone as determined by the local operating system.
|
void |
setValueAsString(String theValue) |
protected void |
setValueAsV3String(String theV3String) |
BaseDateTimeType |
setYear(int theYear)
Sets the year, e.g.
|
Calendar |
toCalendar()
Returns a view of this date/time as a Calendar object.
|
String |
toHumanDisplay()
Returns a human readable version of this date/time using the system local format.
|
String |
toHumanDisplayLocalTimezone()
Returns a human readable version of this date/time using the system local format, converted to the local timezone
if neccesary.
|
asStringValue, copy, equalsDeep, equalsShallow, forceStringValue, fromStringValue, getProperty, getTypesForProperty, getValue, getValueAsString, hashCode, hasPrimitiveValue, hasValue, isEmpty, isPrimitive, makeProperty, primitiveValue, readExternal, setProperty, setProperty, toString, typedCopy, updateStringValue, writeExternaladdChild, addExtension, addExtension, addExtension, copyValues, fhirType, getExtension, getExtensionByUrl, getExtensionFirstRep, getExtensionsByUrl, getExtensionString, getId, getIdBase, getIdElement, getNamedProperty, hasExtension, hasExtension, hasId, hasIdElement, isDisallowExtensions, listChildren, noExtensions, removeExtension, setDisallowExtensions, setExtension, setId, setIdBase, setIdElementcastToAddress, 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, setUserDataINNclone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitfhirType, getFormatCommentsPost, getFormatCommentsPre, getUserData, hasFormatComment, setUserDatapublic BaseDateTimeType()
public BaseDateTimeType(Date theDate, ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision)
IllegalArgumentException - If the specified precision is not allowed for this typepublic BaseDateTimeType(Date theDate, ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision, TimeZone theTimeZone)
public BaseDateTimeType(String theString)
IllegalArgumentException - If the specified precision is not allowed for this typepublic void add(int theField, int theValue)
theField - The field, uses constants from Calendar such as Calendar.YEARtheValue - The number to add (or subtract for a negative number)public boolean after(DateTimeType theDateTimeType)
true if the given object represents a date/time before this objectNullPointerException - If this.getValue() or theDateTimeType.getValue()
return nullpublic boolean before(DateTimeType theDateTimeType)
true if the given object represents a date/time before this objectNullPointerException - If this.getValue() or theDateTimeType.getValue()
return nullprotected String encode(Date theValue)
PrimitiveTypeencode in class PrimitiveType<Date>theValue - Will not be nullprotected abstract ca.uhn.fhir.model.api.TemporalPrecisionEnum getDefaultPrecisionForDatatype()
public Integer getMillis()
Note that this method returns the
same value as getNanos() but with less precision.
public Long getNanos()
Note that this method returns the
same value as getMillis() but with more precision.
public ca.uhn.fhir.model.api.TemporalPrecisionEnum getPrecision()
setPrecision(TemporalPrecisionEnum)public TimeZone getTimeZone()
null if no timezone was
supplied.public GregorianCalendar getValueAsCalendar()
GregorianCalendarpublic boolean isTimeZoneZulu()
public boolean isToday()
true if this object represents a date that is today's dateNullPointerException - if PrimitiveType.getValue() returns nullprotected Date parse(String theValue) throws ca.uhn.fhir.parser.DataFormatException
PrimitiveTypeparse in class PrimitiveType<Date>theValue - Will not be nullca.uhn.fhir.parser.DataFormatExceptionpublic BaseDateTimeType setDay(int theDay)
public BaseDateTimeType setHour(int theHour)
public BaseDateTimeType setMillis(int theMillis)
Note that this method sets the
same value as setNanos(long) but with less precision.
public BaseDateTimeType setMinute(int theMinute)
public BaseDateTimeType setMonth(int theMonth)
public BaseDateTimeType setNanos(long theNanos)
Note that this method sets the
same value as setMillis(int) but with more precision.
public void setPrecision(ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision) throws ca.uhn.fhir.parser.DataFormatException
ca.uhn.fhir.parser.DataFormatExceptionpublic BaseDateTimeType setSecond(int theSecond)
public BaseDateTimeType setTimeZone(TimeZone theTimeZone)
public BaseDateTimeType setTimeZoneZulu(boolean theTimeZoneZulu)
public BaseDateTimeType setValue(Date theValue)
setValue in interface org.hl7.fhir.instance.model.api.IPrimitiveType<Date>setValue in class PrimitiveType<Date>public void setValue(Date theValue, ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision) throws ca.uhn.fhir.parser.DataFormatException
theValue - The date valuethePrecision - The precisionca.uhn.fhir.parser.DataFormatExceptionpublic void setValueAsString(String theValue) throws ca.uhn.fhir.parser.DataFormatException
setValueAsString in interface org.hl7.fhir.instance.model.api.IPrimitiveType<Date>setValueAsString in class PrimitiveType<Date>ca.uhn.fhir.parser.DataFormatExceptionprotected void setValueAsV3String(String theV3String)
public BaseDateTimeType setYear(int theYear)
public Calendar toCalendar()
this object. Changes to the
calendar will not affect this.public String toHumanDisplay()
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.
public String toHumanDisplayLocalTimezone()
public boolean isDateTime()
isDateTime in class Basepublic BaseDateTimeType dateTimeValue()
dateTimeValue in class Basepublic boolean hasTime()
public Boolean equalsUsingFhirPathRules(BaseDateTimeType theOther)
.[0]+ while the other includes only SECONDS precision (irrespecitve of the timezone)public String fpValue()
fpValue in class PrimitiveType<Date>Copyright © 2014–2021 Health Level 7. All rights reserved.