Class IdDt

    • Constructor Detail

      • IdDt

        public IdDt()
        Create a new empty ID
      • IdDt

        public IdDt​(long theId)
        Create a new ID using a long
      • IdDt

        public IdDt​(String theValue)
        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

        public IdDt​(String theResourceType,
                    BigDecimal theIdPart)
        Constructor
        Parameters:
        theResourceType - The resource type (e.g. "Patient")
        theIdPart - The ID (e.g. "123")
      • IdDt

        public IdDt​(String theResourceType,
                    Long theIdPart)
        Constructor
        Parameters:
        theResourceType - The resource type (e.g. "Patient")
        theIdPart - The ID (e.g. "123")
      • IdDt

        public IdDt​(String theResourceType,
                    String theId)
        Constructor
        Parameters:
        theResourceType - The resource type (e.g. "Patient")
        theId - The ID (e.g. "123")
      • IdDt

        public IdDt​(String theResourceType,
                    String theId,
                    String theVersionId)
        Constructor
        Parameters:
        theResourceType - The resource type (e.g. "Patient")
        theId - The ID (e.g. "123")
        theVersionId - The version ID ("e.g. "456")
      • IdDt

        public IdDt​(String theBaseUrl,
                    String theResourceType,
                    String theId,
                    String theVersionId)
        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

        public IdDt​(UriDt theUrl)
        Creates an ID based on a given URL
    • Method Detail

      • equals

        public boolean equals​(Object theArg0)
        Overrides:
        equals in class UriDt
      • equalsIgnoreBase

        public boolean equalsIgnoreBase​(IdDt theId)
        Returns true if this IdDt matches the given IdDt in terms of resource type and ID, but ignores the URL base
      • getBaseUrl

        public String getBaseUrl()
        Returns the portion of this resource ID which corresponds to the server base URL. For example given the resource ID 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")

        Specified by:
        getBaseUrl in interface IIdType
      • getIdPart

        public 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".
        Specified by:
        getIdPart in interface IIdType
      • getIdPartAsBigDecimal

        public BigDecimal getIdPartAsBigDecimal()
        Returns the unqualified portion of this ID as a big decimal, or null if the value is null
        Throws:
        NumberFormatException - If the value is not a valid BigDecimal
      • getVersionIdPartAsLong

        public Long 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 a Long.
        Specified by:
        getVersionIdPartAsLong in interface IIdType
      • hasBaseUrl

        public boolean hasBaseUrl()
        Returns true if this ID has a base url
        Specified by:
        hasBaseUrl in interface IIdType
        See Also:
        getBaseUrl()
      • hasIdPart

        public boolean hasIdPart()
        Description copied from interface: IIdType
        Returns true 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
        Specified by:
        hasIdPart in interface IIdType
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class UriDt
      • isAbsolute

        public boolean isAbsolute()
        Returns true if this ID contains an absolute URL (in other words, a URL starting with "http://" or "https://"
        Specified by:
        isAbsolute in interface IIdType
      • isIdPartValid

        public boolean isIdPartValid()
        Description copied from interface: IIdType
        Returns true if the ID 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 interface IIdType
      • isLocal

        public boolean isLocal()
        Returns true if the ID is a local reference (in other words, it begins with the '#' character)
        Specified by:
        isLocal in interface IIdType
      • 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
        Specified by:
        setParts in interface IIdType
        Returns:
        Returns a reference to this for easy method chaining
      • toUnqualified

        public IdDt 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 interface IIdType
      • withResourceType

        public IdDt withResourceType​(String theResourceName)
        Description copied from interface: IIdType
        Returns a copy of this object, but with a different resource 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 interface IIdType
      • withServerBase

        public IdDt 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). 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 interface IIdType
        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

        public IdDt 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.
        Specified by:
        withVersion in interface IIdType
        Parameters:
        theVersion - The actual version string, e.g. "1". If theVersion is blank or null, returns the same as toVersionless()}
        Returns:
        A new instance of IdDt which is identical, but refers to the specific version of this resource ID noted by theVersion.
      • isValidLong

        public static boolean isValidLong​(String id)
      • newRandomUuid

        public static IdDt newRandomUuid()
        Construct a new ID with with form "urn:uuid:[UUID]" where [UUID] is a new, randomly created UUID generated by UUID.randomUUID()
      • of

        public static IdDt of​(IBaseResource theResouce)
        Retrieves the ID from the given resource instance