diff --git a/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/model/IdType.java b/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/model/IdType.java index a68f0a034..31d4028d6 100644 --- a/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/model/IdType.java +++ b/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/model/IdType.java @@ -409,6 +409,11 @@ public final class IdType extends UriType implements IPrimitiveType, IId return getValue(); } + @Override + public String asStringValue() { + return getValue(); + } + @Override public String getVersionIdPart() { return myUnqualifiedVersionId; diff --git a/org.hl7.fhir.dstu2016may/src/main/java/org/hl7/fhir/dstu2016may/model/IdType.java b/org.hl7.fhir.dstu2016may/src/main/java/org/hl7/fhir/dstu2016may/model/IdType.java index b8683e7a3..ac2d97c93 100644 --- a/org.hl7.fhir.dstu2016may/src/main/java/org/hl7/fhir/dstu2016may/model/IdType.java +++ b/org.hl7.fhir.dstu2016may/src/main/java/org/hl7/fhir/dstu2016may/model/IdType.java @@ -387,6 +387,11 @@ public final class IdType extends UriType implements IPrimitiveType, IId return getValue(); } + @Override + public String asStringValue() { + return getValue(); + } + @Override public String getVersionIdPart() { return myUnqualifiedVersionId; diff --git a/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/model/IdType.java b/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/model/IdType.java index 2e16c2395..ba244e224 100644 --- a/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/model/IdType.java +++ b/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/model/IdType.java @@ -384,6 +384,11 @@ public final class IdType extends UriType implements IPrimitiveType, IId return getValue(); } + @Override + public String asStringValue() { + return getValue(); + } + @Override public String getVersionIdPart() { return myUnqualifiedVersionId; diff --git a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/IdType.java b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/IdType.java index 02f12aedf..db2bb9804 100644 --- a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/IdType.java +++ b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/IdType.java @@ -495,6 +495,11 @@ public final class IdType extends UriType implements IPrimitiveType, IId return getValue(); } + @Override + public String asStringValue() { + return getValue(); + } + /** * Set the value *

diff --git a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/model/IdType.java b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/model/IdType.java index 5d69aa4c4..26991e9fd 100644 --- a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/model/IdType.java +++ b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/model/IdType.java @@ -493,6 +493,11 @@ public final class IdType extends UriType implements IPrimitiveType, IId return getValue(); } + @Override + public String asStringValue() { + return getValue(); + } + /** * Set the value *

diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/IdType.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/IdType.java index dcf35cf8f..87cfceb15 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/IdType.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/IdType.java @@ -493,6 +493,11 @@ public final class IdType extends UriType implements IPrimitiveType, IId return getValue(); } + @Override + public String asStringValue() { + return getValue(); + } + /** * Set the value *

diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/model/IdTypeTest.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/model/IdTypeTest.java new file mode 100644 index 000000000..1c94ad4d2 --- /dev/null +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/model/IdTypeTest.java @@ -0,0 +1,25 @@ +package org.hl7.fhir.r5.model; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class IdTypeTest { + + @Test + public void testAsString() { + IdType t = new IdType("Patient/123"); + assertEquals("Patient/123", t.asStringValue()); + assertEquals("Patient/123", t.getValueAsString()); + assertEquals("Patient/123", t.getValue()); + } + + @Test + public void testAsStringFromComponentParts() { + IdType t = new IdType("http://foo", "Patient", "123", "1"); + assertEquals("http://foo/Patient/123/_history/1", t.asStringValue()); + assertEquals("http://foo/Patient/123/_history/1", t.getValueAsString()); + assertEquals("http://foo/Patient/123/_history/1", t.getValue()); + } + +}