
Class IdDt
- All Implemented Interfaces:
IDatatype,IElement,IIdentifiableElement,IPrimitiveDatatype<String>,ISupportsUndeclaredExtensions,Externalizable,Serializable,IBase,IBaseDatatype,IIdType,IPrimitiveType<String>
Description: A whole number in the range 0 to 2^64-1 (optionally represented in hex), a uuid, an oid, or any other combination of lowercase letters, numerals, "-" and ".", with a length limit of 36 characters.
regex: [a-z-Z0-9\-\.]{1,36}
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionIdDt()Create a new empty IDIdDt(long theId) Create a new ID using a longCopy ConstructorCreates an ID based on a given URLCreate a new ID using a string.ConstructorConstructorConstructorConstructorIdDt(String theResourceType, BigDecimal theIdPart) ConstructorIdDt(BigDecimal thePid) Create a new ID, using a BigDecimal input. -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyTo(IBaseResource theResouce) Deprecated.booleanbooleanequalsIgnoreBase(IdDt theId) Returns true if this IdDt matches the given IdDt in terms of resource type and ID, but ignores the URL baseReturns the portion of this resource ID which corresponds to the server base URL.Returns only the logical ID part of this ID.Returns the unqualified portion of this ID as a big decimal, ornullif the value is nullReturns the unqualified portion of this ID as aLong, ornullif the value is nullgetValue()Returns the value of this ID.Returns the version ID part of this ID (e.g. in the ID http://example.com/Patient/123/_history/456 this would be the part "456") parsed as aLong.booleanReturns true if this ID has a base urlinthashCode()booleanReturnstrueif this ID contains an actual ID part.booleanbooleanbooleanReturnstrueif this ID contains an absolute URL (in other words, a URL starting with "http://" or "https://"booleanisEmpty()booleanReturnstrueif theID part of this objectis valid according to the FHIR rules for valid IDs.booleanReturnstrueif theID part of this objectcontains only numbersbooleanisLocal()Returnstrueif the ID is a local reference (in other words, it begins with the '#' character)static booleanisValidLong(String id) booleanReturnstrueif theversion ID part of this objectcontains only numbersstatic IdDtConstruct a new ID with with form "urn:uuid:[UUID]" where [UUID] is a new, randomly created UUID generated byUUID.randomUUID()static IdDtof(IBaseResource theResouce) Retrieves the ID from the given resource instancevoidDeprecated.Sets the value of this ID by combining all of the individual parts.Set the valuevoidsetValueAsString(String theValue) Set the valuetoString()Returns a new IdDt containing this IdDt's values but with no server base URL if one is present in this IdDt.withResourceType(String theResourceName) Returns a copy of this object, but with a differentresource type(or if this object does not have a resource type currently, returns a copy of this object with the given resource type).withServerBase(String theServerBase, String theResourceType) Returns a view of this ID as a fully qualified URL, given a server base and resource name (which will only be used if the ID does not already contain those respective parts).withVersion(String theVersion) Creates a new instance of this ID which is identical, but refers to the specific version of this resource ID noted by theVersion.Methods inherited from class ca.uhn.fhir.model.api.BasePrimitive
hasValue, readExternal, updateStringValue, writeExternalMethods inherited from class ca.uhn.fhir.model.api.BaseIdentifiableElement
getElementSpecificId, getId, setElementSpecificId, setIdMethods inherited from class ca.uhn.fhir.model.api.BaseElement
addUndeclaredExtension, addUndeclaredExtension, addUndeclaredExtension, getAllUndeclaredExtensions, getFormatCommentsPost, getFormatCommentsPre, getUndeclaredExtensions, getUndeclaredExtensionsByUrl, getUndeclaredModifierExtensions, getUserData, hasFormatComment, isBaseEmpty, setUserDataMethods inherited from class java.lang.Object
clone, 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.IPrimitiveType
hasValue
-
Constructor Details
-
IdDt
public IdDt()Create a new empty ID -
IdDt
Create a new ID, using a BigDecimal input. UsesBigDecimal.toPlainString()to generate the string representation. -
IdDt
Create a new ID using a long -
IdDt
Create a new ID using a string. This String may contain a simple ID (e.g. "1234") or it may contain a complete URL (http://example.com/fhir/Patient/1234).Description: A whole number in the range 0 to 2^64-1 (optionally represented in hex), a uuid, an oid, or any other combination of lowercase letters, numerals, "-" and ".", with a length limit of 36 characters.
regex: [a-z0-9\-\.]{1,36}
-
IdDt
Constructor- Parameters:
theResourceType- The resource type (e.g. "Patient")theIdPart- The ID (e.g. "123")
-
IdDt
Constructor- Parameters:
theResourceType- The resource type (e.g. "Patient")theIdPart- The ID (e.g. "123")
-
IdDt
Constructor- Parameters:
theResourceType- The resource type (e.g. "Patient")theId- The ID (e.g. "123")
-
IdDt
Constructor- Parameters:
theResourceType- The resource type (e.g. "Patient")theId- The ID (e.g. "123")theVersionId- The version ID ("e.g. "456")
-
IdDt
Constructor- Parameters:
theBaseUrl- The server base URL (e.g. "http://example.com/fhir")theResourceType- The resource type (e.g. "Patient")theId- The ID (e.g. "123")theVersionId- The version ID ("e.g. "456")
-
IdDt
-
IdDt
Creates an ID based on a given URL -
IdDt
Copy Constructor
-
-
Method Details
-
applyTo
-
asBigDecimal
Deprecated.UsegetIdPartAsBigDecimal()instead (this method was deprocated because its name is ambiguous) -
equals
-
equalsIgnoreBase
Returns true if this IdDt matches the given IdDt in terms of resource type and ID, but ignores the URL base -
getBaseUrl
Returns the portion of this resource ID which corresponds to the server base URL. For example given the resource IDhttp://example.com/fhir/Patient/123the base URL would behttp://example.com/fhir.This method may return null if the ID contains no base (e.g. "Patient/123")
- Specified by:
getBaseUrlin interfaceIIdType
-
getIdPart
Returns only the logical ID part of this ID. For example, given the ID "http://example,.com/fhir/Patient/123/_history/456", this method would return "123". -
getIdPartAsBigDecimal
Returns the unqualified portion of this ID as a big decimal, ornullif the value is null- Throws:
NumberFormatException- If the value is not a valid BigDecimal
-
getIdPartAsLong
Returns the unqualified portion of this ID as aLong, ornullif the value is null- Specified by:
getIdPartAsLongin interfaceIIdType- Throws:
NumberFormatException- If the value is not a valid Long
-
getResourceType
- Specified by:
getResourceTypein interfaceIIdType
-
getValue
Returns the value of this ID. Note that this value may be a fully qualified URL, a relative/partial URL, or a simple ID. UsegetIdPart()to get just the ID portion.- Specified by:
getValuein interfaceIIdType- Specified by:
getValuein interfaceIPrimitiveDatatype<String>- Specified by:
getValuein interfaceIPrimitiveType<String>- Overrides:
getValuein classBasePrimitive<String>- See Also:
-
setValue
Set the valueDescription: A whole number in the range 0 to 2^64-1 (optionally represented in hex), a uuid, an oid, or any other combination of lowercase letters, numerals, "-" and ".", with a length limit of 36 characters.
regex: [a-z0-9\-\.]{1,36}
- Specified by:
setValuein interfaceIIdType- Specified by:
setValuein interfaceIPrimitiveDatatype<String>- Specified by:
setValuein interfaceIPrimitiveType<String>- Overrides:
setValuein classBasePrimitive<String>- Throws:
DataFormatException
-
getValueAsString
- Specified by:
getValueAsStringin interfaceIPrimitiveDatatype<String>- Specified by:
getValueAsStringin interfaceIPrimitiveType<String>- Overrides:
getValueAsStringin classBasePrimitive<String>
-
setValueAsString
Set the valueDescription: A whole number in the range 0 to 2^64-1 (optionally represented in hex), a uuid, an oid, or any other combination of lowercase letters, numerals, "-" and ".", with a length limit of 36 characters.
regex: [a-z0-9\-\.]{1,36}
- Specified by:
setValueAsStringin interfaceIPrimitiveDatatype<String>- Specified by:
setValueAsStringin interfaceIPrimitiveType<String>- Overrides:
setValueAsStringin classBasePrimitive<String>- Throws:
DataFormatException
-
getVersionIdPart
- Specified by:
getVersionIdPartin interfaceIIdType
-
getVersionIdPartAsLong
Description copied from interface:IIdTypeReturns the version ID part of this ID (e.g. in the ID http://example.com/Patient/123/_history/456 this would be the part "456") parsed as aLong.- Specified by:
getVersionIdPartAsLongin interfaceIIdType
-
hasBaseUrl
Returns true if this ID has a base url- Specified by:
hasBaseUrlin interfaceIIdType- See Also:
-
hasIdPart
Description copied from interface:IIdTypeReturnstrueif this ID contains an actual ID part. For example, the ID part is the '123' in the following ID:http://example.com/fhir/Patient/123/_history/55 -
hasResourceType
- Specified by:
hasResourceTypein interfaceIIdType
-
hasVersionIdPart
- Specified by:
hasVersionIdPartin interfaceIIdType
-
hashCode
-
isAbsolute
Returnstrueif this ID contains an absolute URL (in other words, a URL starting with "http://" or "https://"- Specified by:
isAbsolutein interfaceIIdType
-
isEmpty
-
isIdPartValid
Description copied from interface:IIdTypeReturnstrueif theID part of this objectis valid according to the FHIR rules for valid IDs.The FHIR specification states:
Any combination of upper or lower case ASCII letters ('A'..'Z', and 'a'..'z', numerals ('0'..'9'), '-' and '.', with a length limit of 64 characters. (This might be an integer, an un-prefixed OID, UUID or any other identifier pattern that meets these constraints.) regex: [A-Za-z0-9\-\.]{1,64}- Specified by:
isIdPartValidin interfaceIIdType
-
isIdPartValidLong
Description copied from interface:IIdTypeReturnstrueif theID part of this objectcontains only numbers- Specified by:
isIdPartValidLongin interfaceIIdType
-
isLocal
Returnstrueif the ID is a local reference (in other words, it begins with the '#' character) -
isVersionIdPartValidLong
Description copied from interface:IIdTypeReturnstrueif theversion ID part of this objectcontains only numbers- Specified by:
isVersionIdPartValidLongin interfaceIIdType
-
setId
Deprecated.Copies the value from the given IdDt tothisIdDt. It is generally not neccesary to use this method but it is provided for consistency with the rest of the API.- Specified by:
setIdin interfaceIIdentifiableElement- Overrides:
setIdin classBaseIdentifiableElement
-
setParts
public IIdType setParts(String theBaseUrl, String theResourceType, String theIdPart, String theVersionIdPart) Description copied from interface:IIdTypeSets the value of this ID by combining all of the individual parts.Required parameters: The following rules apply to the parameters of this method (in this case, populated means a non-empty string and not populated means
nullor an empty string)- All values may be not populated
- If theVersionIdPart is populated, theResourceType and theIdPart must be populated
- If theBaseUrl is populated and theIdPart is populated, theResourceType must be populated
-
toString
- Overrides:
toStringin classBasePrimitive<String>
-
toUnqualified
Returns a new IdDt containing this IdDt's values but with no server base URL if one is present in this IdDt. For example, if this IdDt contains the ID "http://foo/Patient/1", this method will return a new IdDt containing ID "Patient/1".- Specified by:
toUnqualifiedin interfaceIIdType
-
toUnqualifiedVersionless
- Specified by:
toUnqualifiedVersionlessin interfaceIIdType
-
toVersionless
- Specified by:
toVersionlessin interfaceIIdType
-
withResourceType
Description copied from interface:IIdTypeReturns a copy of this object, but with a differentresource type(or if this object does not have a resource type currently, returns a copy of this object with the given resource type).Note that if this object represents a local reference (e.g.
#foo) or a URN (e.g.urn:oid:1.2.3.4) this method will simply return a copy of this object with no modifications.- Specified by:
withResourceTypein interfaceIIdType
-
withServerBase
Returns a view of this ID as a fully qualified URL, given a server base and resource name (which will only be used if the ID does not already contain those respective parts). Essentially, because IdDt can contain either a complete URL or a partial one (or even jut a simple ID), this method may be used to translate into a complete URL.- Specified by:
withServerBasein interfaceIIdType- Parameters:
theServerBase- The server base (e.g. "http://example.com/fhir")theResourceType- The resource name (e.g. "Patient")- Returns:
- A fully qualified URL for this ID (e.g. "http://example.com/fhir/Patient/1")
-
withVersion
Creates a new instance of this ID which is identical, but refers to the specific version of this resource ID noted by theVersion.- Specified by:
withVersionin interfaceIIdType- Parameters:
theVersion- The actual version string, e.g. "1". If theVersion is blank or null, returns the same astoVersionless()}- Returns:
- A new instance of IdDt which is identical, but refers to the specific version of this resource ID noted by theVersion.
-
isValidLong
-
newRandomUuid
Construct a new ID with with form "urn:uuid:[UUID]" where [UUID] is a new, randomly created UUID generated byUUID.randomUUID() -
of
Retrieves the ID from the given resource instance
-
getIdPartAsBigDecimal()instead (this method was deprocated because its name is ambiguous)