public final class IdType extends UriType implements org.hl7.fhir.instance.model.api.IPrimitiveType<String>, org.hl7.fhir.instance.model.api.IIdType
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.)
This class contains that logical ID, and can optionally also contain a relative or absolute URL representing the resource identity. For example, the following are all valid values for IdType, and all might represent the same resource:
123 (just a resource's ID)Patient/123 (a relative identity)http://example.com/Patient/123 (an absolute identity)http://example.com/Patient/123/_history/1 (an absolute identity with a version id)
Patient/123/_history/1 (a relative identity with a version id)
Note that the 64 character limit applies only to the ID portion ("123" in the examples above).
In most situations, you only need to populate the resource's ID (e.g.
123) in resources you are constructing and the encoder will
infer the rest from the context in which the object is being used. On the
other hand, the parser will always try to populate the complete absolute
identity on objects it creates as a convenience.
Regex for ID: [a-z0-9\-\.]{1,36}
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_LENGTH
This is the maximum length for the ID
|
static String |
URN_PREFIX |
| Constructor and Description |
|---|
IdType()
Create a new empty ID
|
IdType(BigDecimal thePid)
Create a new ID, using a BigDecimal input.
|
IdType(long theId)
Create a new ID using a long
|
IdType(String theValue)
Create a new ID using a string.
|
IdType(String theResourceType,
BigDecimal theIdPart)
Constructor
|
IdType(String theResourceType,
Long theIdPart)
Constructor
|
IdType(String theResourceType,
String theId)
Constructor
|
IdType(String theResourceType,
String theId,
String theVersionId)
Constructor
|
IdType(String theBaseUrl,
String theResourceType,
String theId,
String theVersionId)
Constructor
|
IdType(UriType theUrl)
Creates an ID based on a given URL
|
| Modifier and Type | Method and Description |
|---|---|
void |
applyTo(org.hl7.fhir.instance.model.api.IBaseResource theResouce) |
BigDecimal |
asBigDecimal()
Deprecated.
Use
getIdPartAsBigDecimal() instead (this method was
deprocated because its name is ambiguous) |
IdType |
copy() |
boolean |
equals(Object theArg0) |
boolean |
equalsIgnoreBase(IdType theId)
Returns true if this IdType matches the given IdType in terms of resource
type and ID, but ignores the URL base
|
String |
fhirType() |
String |
getBaseUrl()
Returns the portion of this resource ID which corresponds to the server
base URL.
|
String |
getIdPart()
Returns only the logical ID part of this ID.
|
BigDecimal |
getIdPartAsBigDecimal()
Returns the unqualified portion of this ID as a big decimal, or
null if the value is null |
Long |
getIdPartAsLong()
Returns the unqualified portion of this ID as a
Long, or
null if the value is null |
String |
getResourceType() |
String |
getValue()
Returns the value of this ID.
|
String |
getValueAsString() |
String |
getVersionIdPart() |
Long |
getVersionIdPartAsLong() |
boolean |
hasBaseUrl()
Returns true if this ID has a base url
|
int |
hashCode() |
boolean |
hasIdPart() |
boolean |
hasResourceType() |
boolean |
hasVersionIdPart() |
boolean |
isAbsolute()
Returns
true if this ID contains an absolute URL (in other
words, a URL starting with "http://" or "https://" |
boolean |
isEmpty() |
boolean |
isIdPartValid() |
boolean |
isIdPartValidLong()
Returns
true if the unqualified ID is a valid Long
value (in other words, it consists only of digits) |
boolean |
isLocal()
Returns
true if the ID is a local reference (in other words,
it begins with the '#' character) |
boolean |
isUrn() |
boolean |
isVersionIdPartValidLong() |
static IdType |
newRandomUuid()
Construct a new ID with with form "urn:uuid:[UUID]" where [UUID] is a new,
randomly created UUID generated by
UUID.randomUUID() |
static IdType |
of(org.hl7.fhir.instance.model.api.IBaseResource theResouce)
Retrieves the ID from the given resource instance
|
org.hl7.fhir.instance.model.api.IIdType |
setParts(String theBaseUrl,
String theResourceType,
String theIdPart,
String theVersionIdPart) |
IdType |
setValue(String theValue)
Set the value
|
void |
setValueAsString(String theValue)
Set the value
|
String |
toString() |
IdType |
toUnqualified()
Returns a new IdType containing this IdType's values but with no server
base URL if one is present in this IdType.
|
IdType |
toUnqualifiedVersionless() |
IdType |
toVersionless() |
IdType |
withResourceType(String theResourceName) |
IdType |
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).
|
IdType |
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.
|
encode, equals, equalsDeep, fromOid, parseasStringValue, equalsShallow, forceStringValue, fpValue, fromStringValue, getProperty, getTypesForProperty, hasPrimitiveValue, hasValue, isPrimitive, makeProperty, primitiveValue, readExternal, setProperty, setProperty, typedCopy, updateStringValue, writeExternaladdChild, addExtension, addExtension, addExtension, copyValues, 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, dateTimeValue, equals, getChildByName, getFormatCommentsPost, getFormatCommentsPre, getNamedProperty, getUserData, getUserInt, getUserString, hasFormatComment, hasType, hasUserData, isBooleanPrimitive, isDateTime, isMetadataBased, isResource, listChildrenByName, listChildrenByName, setUserData, setUserDataINNclone, finalize, getClass, notify, notifyAll, wait, wait, waithasValue, toValueOrNullgetFormatCommentsPost, getFormatCommentsPre, getUserData, hasFormatComment, setUserDatapublic static final String URN_PREFIX
public static final int MAX_LENGTH
public IdType()
public IdType(BigDecimal thePid)
BigDecimal.toPlainString() to generate the string representation.public IdType(long theId)
public IdType(String theValue)
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}
public IdType(String theResourceType, BigDecimal theIdPart)
theResourceType - The resource type (e.g. "Patient")theIdPart - The ID (e.g. "123")public IdType(String theResourceType, Long theIdPart)
theResourceType - The resource type (e.g. "Patient")theIdPart - The ID (e.g. "123")public IdType(String theResourceType, String theId)
theResourceType - The resource type (e.g. "Patient")theId - The ID (e.g. "123")public IdType(String theResourceType, String theId, String theVersionId)
theResourceType - The resource type (e.g. "Patient")theId - The ID (e.g. "123")theVersionId - The version ID ("e.g. "456")public IdType(String theBaseUrl, String theResourceType, String theId, String theVersionId)
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")public void applyTo(org.hl7.fhir.instance.model.api.IBaseResource theResouce)
applyTo in interface org.hl7.fhir.instance.model.api.IIdType@Deprecated public BigDecimal asBigDecimal()
getIdPartAsBigDecimal() instead (this method was
deprocated because its name is ambiguous)public boolean equalsIgnoreBase(IdType theId)
public String getBaseUrl()
http://example.com/fhir/Patient/123 the base URL would be
http://example.com/fhir.
This method may return null if the ID contains no base (e.g. "Patient/123")
getBaseUrl in interface org.hl7.fhir.instance.model.api.IIdTypepublic String getIdPart()
getIdPart in interface org.hl7.fhir.instance.model.api.IIdTypepublic BigDecimal getIdPartAsBigDecimal()
null if the value is nullNumberFormatException - If the value is not a valid BigDecimalpublic Long getIdPartAsLong()
Long, or
null if the value is nullgetIdPartAsLong in interface org.hl7.fhir.instance.model.api.IIdTypeNumberFormatException - If the value is not a valid Longpublic String getResourceType()
getResourceType in interface org.hl7.fhir.instance.model.api.IIdTypepublic String getValue()
getIdPart() to
get just the ID portion.getValue in interface org.hl7.fhir.instance.model.api.IIdTypegetValue in interface org.hl7.fhir.instance.model.api.IPrimitiveType<String>getValue in class PrimitiveType<String>getIdPart()public IdType setValue(String theValue)
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}
setValue in interface org.hl7.fhir.instance.model.api.IIdTypesetValue in interface org.hl7.fhir.instance.model.api.IPrimitiveType<String>setValue in class PrimitiveType<String>public String getValueAsString()
getValueAsString in interface org.hl7.fhir.instance.model.api.IPrimitiveType<String>getValueAsString in class PrimitiveType<String>public void setValueAsString(String theValue)
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}
setValueAsString in interface org.hl7.fhir.instance.model.api.IPrimitiveType<String>setValueAsString in class PrimitiveType<String>public String getVersionIdPart()
getVersionIdPart in interface org.hl7.fhir.instance.model.api.IIdTypepublic Long getVersionIdPartAsLong()
getVersionIdPartAsLong in interface org.hl7.fhir.instance.model.api.IIdTypepublic boolean hasBaseUrl()
hasBaseUrl in interface org.hl7.fhir.instance.model.api.IIdTypegetBaseUrl()public boolean hasIdPart()
hasIdPart in interface org.hl7.fhir.instance.model.api.IIdTypepublic boolean hasResourceType()
hasResourceType in interface org.hl7.fhir.instance.model.api.IIdTypepublic boolean hasVersionIdPart()
hasVersionIdPart in interface org.hl7.fhir.instance.model.api.IIdTypepublic boolean isAbsolute()
true if this ID contains an absolute URL (in other
words, a URL starting with "http://" or "https://"isAbsolute in interface org.hl7.fhir.instance.model.api.IIdTypepublic boolean isEmpty()
isEmpty in interface org.hl7.fhir.instance.model.api.IBaseisEmpty in interface org.hl7.fhir.instance.model.api.IIdTypeisEmpty in class PrimitiveType<String>public boolean isIdPartValid()
isIdPartValid in interface org.hl7.fhir.instance.model.api.IIdTypepublic boolean isIdPartValidLong()
true if the unqualified ID is a valid Long
value (in other words, it consists only of digits)isIdPartValidLong in interface org.hl7.fhir.instance.model.api.IIdTypepublic boolean isLocal()
true if the ID is a local reference (in other words,
it begins with the '#' character)isLocal in interface org.hl7.fhir.instance.model.api.IIdTypepublic boolean isUrn()
public boolean isVersionIdPartValidLong()
isVersionIdPartValidLong in interface org.hl7.fhir.instance.model.api.IIdTypepublic org.hl7.fhir.instance.model.api.IIdType setParts(String theBaseUrl, String theResourceType, String theIdPart, String theVersionIdPart)
setParts in interface org.hl7.fhir.instance.model.api.IIdTypepublic String toString()
toString in class PrimitiveType<String>public IdType toUnqualified()
toUnqualified in interface org.hl7.fhir.instance.model.api.IIdTypepublic IdType toUnqualifiedVersionless()
toUnqualifiedVersionless in interface org.hl7.fhir.instance.model.api.IIdTypepublic IdType toVersionless()
toVersionless in interface org.hl7.fhir.instance.model.api.IIdTypepublic IdType withResourceType(String theResourceName)
withResourceType in interface org.hl7.fhir.instance.model.api.IIdTypepublic IdType withServerBase(String theServerBase, String theResourceType)
withServerBase in interface org.hl7.fhir.instance.model.api.IIdTypetheServerBase - The server base (e.g. "http://example.com/fhir")theResourceType - The resource name (e.g. "Patient")public IdType withVersion(String theVersion)
withVersion in interface org.hl7.fhir.instance.model.api.IIdTypetheVersion - The actual version string, e.g. "1". If theVersion is blank or null, returns the same as toVersionless()}public static IdType newRandomUuid()
UUID.randomUUID()Copyright © 2014–2021 Health Level 7. All rights reserved.