Interface IIdType
-
- All Superinterfaces:
IBase,IBaseDatatype,IElement,IPrimitiveType<String>,Serializable
- All Known Implementing Classes:
IdDt
public interface IIdType extends IPrimitiveType<String>
Base interface for ID datatype.Concrete Implementations: This interface is often returned and/or accepted by methods in HAPI's API where either
IdDt(the HAPI structure ID type) ororg.hl7.fhir.instance.model.IdType(the RI structure ID type) will be used, depending on which version of the strctures your application is using.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidapplyTo(IBaseResource theResource)StringgetBaseUrl()Returns the server base URL if this ID contains one.StringgetIdPart()Returns only the logical ID part of this ID.LonggetIdPartAsLong()Returns the ID part of this ID (e.g.StringgetResourceType()StringgetValue()Returns the value of this ID.StringgetVersionIdPart()LonggetVersionIdPartAsLong()Returns the version ID part of this ID (e.g.booleanhasBaseUrl()booleanhasIdPart()Returnstrueif this ID contains an actual ID part.booleanhasResourceType()booleanhasVersionIdPart()booleanisAbsolute()Returnstrueif this ID contains an absolute URL (in other words, a URL starting with "http://" or "https://"booleanisEmpty()booleanisIdPartValid()Returnstrueif theID part of this objectis valid according to the FHIR rules for valid IDs.booleanisIdPartValidLong()Returnstrueif theID part of this objectcontains only numbersbooleanisLocal()Returnstrueif the ID is a local reference (in other words, it begins with the '#' character)booleanisVersionIdPartValidLong()Returnstrueif theversion ID part of this objectcontains only numbersIIdTypesetParts(String theBaseUrl, String theResourceType, String theIdPart, String theVersionIdPart)Sets the value of this ID by combining all of the individual parts.IIdTypesetValue(String theString)IIdTypetoUnqualified()IIdTypetoUnqualifiedVersionless()IIdTypetoVersionless()IIdTypewithResourceType(String theResName)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).IIdTypewithServerBase(String theServerBase, String theResourceName)Returns a copy of this object, but with a differentresource typeandbase URL(or if this object does not have a resource type currently, returns a copy of this object with the given server base and resource type).IIdTypewithVersion(String theVersion)Returns a copy of this object, but with a differentversion ID(or if this object does not have a resource type currently, returns a copy of this object with the given version).-
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
getValueAsString, hasValue, setValueAsString
-
-
-
-
Method Detail
-
applyTo
void applyTo(IBaseResource theResource)
-
getBaseUrl
String getBaseUrl()
Returns the server base URL if this ID contains one. For example, the base URL is the 'http://example.com/fhir' in the following ID:http://example.com/fhir/Patient/123/_history/55
-
getIdPart
String 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".
-
getIdPartAsLong
Long getIdPartAsLong()
Returns the ID part of this ID (e.g. in the ID http://example.com/Patient/123/_history/456 this would be the part "123") parsed as aLong.- Throws:
NumberFormatException- If the value can't be parsed as a long
-
getResourceType
String getResourceType()
-
getValue
String 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 interfaceIPrimitiveType<String>- See Also:
getIdPart()
-
getVersionIdPart
String getVersionIdPart()
-
getVersionIdPartAsLong
Long getVersionIdPartAsLong()
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.- Throws:
NumberFormatException- If the value can't be parsed as a long
-
hasBaseUrl
boolean hasBaseUrl()
-
hasIdPart
boolean hasIdPart()
Returnstrueif 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
boolean hasResourceType()
-
hasVersionIdPart
boolean hasVersionIdPart()
-
isAbsolute
boolean isAbsolute()
Returnstrueif this ID contains an absolute URL (in other words, a URL starting with "http://" or "https://"
-
isIdPartValid
boolean isIdPartValid()
Returnstrueif 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}
-
isIdPartValidLong
boolean isIdPartValidLong()
Returnstrueif theID part of this objectcontains only numbers
-
isLocal
boolean isLocal()
Returnstrueif the ID is a local reference (in other words, it begins with the '#' character)
-
isVersionIdPartValidLong
boolean isVersionIdPartValidLong()
Returnstrueif theversion ID part of this objectcontains only numbers
-
setValue
IIdType setValue(String theString)
- Specified by:
setValuein interfaceIPrimitiveType<String>
-
toUnqualified
IIdType toUnqualified()
-
toUnqualifiedVersionless
IIdType toUnqualifiedVersionless()
-
toVersionless
IIdType toVersionless()
-
withResourceType
IIdType withResourceType(String theResName)
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.
-
withServerBase
IIdType withServerBase(String theServerBase, String theResourceName)
Returns a copy of this object, but with a differentresource typeandbase URL(or if this object does not have a resource type currently, returns a copy of this object with the given server base and 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.
-
withVersion
IIdType withVersion(String theVersion)
Returns a copy of this object, but with a differentversion ID(or if this object does not have a resource type currently, returns a copy of this object with the given version).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.
-
setParts
IIdType setParts(String theBaseUrl, String theResourceType, String theIdPart, String theVersionIdPart)
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
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
- Returns:
- Returns a reference to
thisfor easy method chaining
-
-