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
ConstructorDescriptionIdDt()
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 TypeMethodDescriptionvoid
applyTo
(IBaseResource theResouce) Deprecated.boolean
boolean
equalsIgnoreBase
(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, ornull
if the value is nullReturns the unqualified portion of this ID as aLong
, ornull
if the value is nullgetValue()
Returns the value of this ID.Returns the version ID part of this ID (e.g.boolean
Returns true if this ID has a base urlint
hashCode()
boolean
Returnstrue
if this ID contains an actual ID part.boolean
boolean
boolean
Returnstrue
if this ID contains an absolute URL (in other words, a URL starting with "http://" or "https://"boolean
isEmpty()
boolean
Returnstrue
if theID part of this object
is valid according to the FHIR rules for valid IDs.boolean
Returnstrue
if theID part of this object
contains only numbersboolean
isLocal()
Returnstrue
if the ID is a local reference (in other words, it begins with the '#' character)static boolean
isValidLong
(String id) boolean
Returnstrue
if theversion ID part of this object
contains only numbersstatic IdDt
Construct a new ID with with form "urn:uuid:[UUID]" where [UUID] is a new, randomly created UUID generated byUUID.randomUUID()
static IdDt
of
(IBaseResource theResouce) Retrieves the ID from the given resource instancevoid
Deprecated.Sets the value of this ID by combining all of the individual parts.Set the valuevoid
setValueAsString
(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, writeExternal
Methods inherited from class ca.uhn.fhir.model.api.BaseIdentifiableElement
getElementSpecificId, getId, setElementSpecificId, setId
Methods inherited from class ca.uhn.fhir.model.api.BaseElement
addUndeclaredExtension, addUndeclaredExtension, addUndeclaredExtension, getAllUndeclaredExtensions, getFormatCommentsPost, getFormatCommentsPre, getUndeclaredExtensions, getUndeclaredExtensionsByUrl, getUndeclaredModifierExtensions, getUserData, hasFormatComment, isBaseEmpty, setUserData
Methods inherited from class java.lang.Object
clone, 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.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/123
the base URL would behttp://example.com/fhir
.This method may return null if the ID contains no base (e.g. "Patient/123")
- Specified by:
getBaseUrl
in 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, ornull
if the value is null- Throws:
NumberFormatException
- If the value is not a valid BigDecimal
-
getIdPartAsLong
Returns the unqualified portion of this ID as aLong
, ornull
if the value is null- Specified by:
getIdPartAsLong
in interfaceIIdType
- Throws:
NumberFormatException
- If the value is not a valid Long
-
getResourceType
- Specified by:
getResourceType
in 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:
getValue
in interfaceIIdType
- Specified by:
getValue
in interfaceIPrimitiveDatatype<String>
- Specified by:
getValue
in interfaceIPrimitiveType<String>
- Overrides:
getValue
in 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:
setValue
in interfaceIIdType
- Specified by:
setValue
in interfaceIPrimitiveDatatype<String>
- Specified by:
setValue
in interfaceIPrimitiveType<String>
- Overrides:
setValue
in classBasePrimitive<String>
- Throws:
DataFormatException
-
getValueAsString
- Specified by:
getValueAsString
in interfaceIPrimitiveDatatype<String>
- Specified by:
getValueAsString
in interfaceIPrimitiveType<String>
- Overrides:
getValueAsString
in 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:
setValueAsString
in interfaceIPrimitiveDatatype<String>
- Specified by:
setValueAsString
in interfaceIPrimitiveType<String>
- Overrides:
setValueAsString
in classBasePrimitive<String>
- Throws:
DataFormatException
-
getVersionIdPart
- Specified by:
getVersionIdPart
in interfaceIIdType
-
getVersionIdPartAsLong
Description copied from interface:IIdType
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
.- Specified by:
getVersionIdPartAsLong
in interfaceIIdType
-
hasBaseUrl
Returns true if this ID has a base url- Specified by:
hasBaseUrl
in interfaceIIdType
- See Also:
-
hasIdPart
Description copied from interface:IIdType
Returnstrue
if 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:
hasResourceType
in interfaceIIdType
-
hasVersionIdPart
- Specified by:
hasVersionIdPart
in interfaceIIdType
-
hashCode
-
isAbsolute
Returnstrue
if this ID contains an absolute URL (in other words, a URL starting with "http://" or "https://"- Specified by:
isAbsolute
in interfaceIIdType
-
isEmpty
-
isIdPartValid
Description copied from interface:IIdType
Returnstrue
if theID part of this object
is 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:
isIdPartValid
in interfaceIIdType
-
isIdPartValidLong
Description copied from interface:IIdType
Returnstrue
if theID part of this object
contains only numbers- Specified by:
isIdPartValidLong
in interfaceIIdType
-
isLocal
Returnstrue
if the ID is a local reference (in other words, it begins with the '#' character) -
isVersionIdPartValidLong
Description copied from interface:IIdType
Returnstrue
if theversion ID part of this object
contains only numbers- Specified by:
isVersionIdPartValidLong
in interfaceIIdType
-
setId
Deprecated.Copies the value from the given IdDt tothis
IdDt. It is generally not neccesary to use this method but it is provided for consistency with the rest of the API.- Specified by:
setId
in interfaceIIdentifiableElement
- Overrides:
setId
in classBaseIdentifiableElement
-
setParts
public IIdType setParts(String theBaseUrl, String theResourceType, String theIdPart, String theVersionIdPart) Description copied from interface:IIdType
Sets 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
null
or 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:
toString
in 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:
toUnqualified
in interfaceIIdType
-
toUnqualifiedVersionless
- Specified by:
toUnqualifiedVersionless
in interfaceIIdType
-
toVersionless
- Specified by:
toVersionless
in interfaceIIdType
-
withResourceType
Description copied from interface:IIdType
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).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:
withResourceType
in 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:
withServerBase
in 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:
withVersion
in 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)