
Package org.hl7.fhir.dstu3.model
Class DateType
-
- 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 DateType extends BaseDateTimeType
Represents a FHIR date datatype. Valid precisions values for this type are:TemporalPrecisionEnum.YEAR
TemporalPrecisionEnum.MONTH
TemporalPrecisionEnum.DAY
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static ca.uhn.fhir.model.api.TemporalPrecisionEnum
DEFAULT_PRECISION
The default precision for this type
-
Constructor Summary
Constructors Constructor Description DateType()
ConstructorDateType(int theYear, int theMonth, int theDay)
Constructor which accepts a date value and uses theDEFAULT_PRECISION
for this type.DateType(String theDate)
Constructor which accepts a date as a string in FHIR formatDateType(Calendar theCalendar)
Constructor which accepts a date value and uses theDEFAULT_PRECISION
for this type.DateType(Date theDate)
Constructor which accepts a date value and uses theDEFAULT_PRECISION
for this typeDateType(Date theDate, ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision)
Constructor which accepts a date value and a precision value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DateType
copy()
String
fhirType()
protected ca.uhn.fhir.model.api.TemporalPrecisionEnum
getDefaultPrecisionForDatatype()
Returns the default precision for this datatypestatic DateType
parseV3(String theV3String)
Creates a new instance by parsing an HL7 v3 format date time stringstatic InstantType
today()
-
Methods inherited from class org.hl7.fhir.dstu3.model.BaseDateTimeType
add, after, before, 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, setValueAsV3String, setYear, toCalendar, toHumanDisplay, toHumanDisplayLocalTimezone
-
Methods inherited from class org.hl7.fhir.dstu3.model.PrimitiveType
asStringValue, equalsDeep, equalsShallow, fromStringValue, getProperty, getValue, getValueAsString, hashCode, hasPrimitiveValue, hasValue, isEmpty, isPrimitive, primitiveValue, readExternal, setProperty, setProperty, toString, typedCopy, updateStringValue, writeExternal
-
Methods inherited from class org.hl7.fhir.dstu3.model.Element
addChild, addExtension, addExtension, addExtension, copyValues, getExtension, getExtensionFirstRep, getExtensionsByUrl, getExtensionString, getId, getIdBase, getIdElement, getNamedProperty, getTypesForProperty, hasExtension, hasExtension, hasId, hasIdElement, listChildren, makeProperty, setExtension, setId, setIdBase, setIdElement
-
Methods inherited from class org.hl7.fhir.dstu3.model.Base
castToAddress, castToAnnotation, castToAttachment, castToBase64Binary, castToBoolean, castToCode, castToCodeableConcept, castToCoding, castToContactDetail, castToContactPoint, castToContributor, castToDataRequirement, castToDate, castToDateTime, castToDecimal, castToDosage, castToDuration, castToElementDefinition, castToExtension, castToHumanName, castToId, castToIdentifier, castToInstant, castToInteger, castToMarkdown, castToMeta, castToMoney, castToNarrative, castToOid, castToParameterDefinition, castToPeriod, castToPositiveInt, castToQuantity, castToRange, castToRatio, castToReference, castToRelatedArtifact, castToResource, castToSampledData, castToSignature, castToSimpleQuantity, castToString, castToTime, castToTiming, castToTriggerDefinition, castToType, castToUnsignedInt, castToUri, castToUsageContext, castToXhtml, castToXhtmlString, children, clearUserData, 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
-
DateType
public DateType()
Constructor
-
DateType
public DateType(Date theDate)
Constructor which accepts a date value and uses theDEFAULT_PRECISION
for this type
-
DateType
public DateType(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.YEAR
TemporalPrecisionEnum.MONTH
TemporalPrecisionEnum.DAY
- Throws:
ca.uhn.fhir.parser.DataFormatException
- If the specified precision is not allowed for this type
-
DateType
public DateType(String theDate)
Constructor which accepts a date as a string in FHIR format- Throws:
ca.uhn.fhir.parser.DataFormatException
- If the precision in the date string is not allowed for this type
-
DateType
public DateType(Calendar theCalendar)
Constructor which accepts a date value and uses theDEFAULT_PRECISION
for this type.
-
DateType
public DateType(int theYear, int theMonth, int theDay)
Constructor which accepts a date value and uses theDEFAULT_PRECISION
for this type.Use caution when using this constructor: The month is 0-indexed but the day is 1-indexed in order to match the bahaviour of the Java
Calendar
type.- Parameters:
theYear
- The year, e.g. 2015theMonth
- The month, e.g. 0 for JanuarytheDay
- The day (1 indexed) e.g. 1 for the first day of the month
-
-
Method Detail
-
getDefaultPrecisionForDatatype
protected ca.uhn.fhir.model.api.TemporalPrecisionEnum getDefaultPrecisionForDatatype()
Returns the default precision for this datatype- Specified by:
getDefaultPrecisionForDatatype
in classBaseDateTimeType
- See Also:
DEFAULT_PRECISION
-
copy
public DateType copy()
- Specified by:
copy
in classPrimitiveType<Date>
-
today
public static InstantType today()
-
parseV3
public static DateType parseV3(String theV3String)
Creates a new instance by parsing an HL7 v3 format date time string
-
-