diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ResourceFactory.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ResourceFactory.java index e46de5e56..821dbf809 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ResourceFactory.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/ResourceFactory.java @@ -678,5 +678,32 @@ public class ResourceFactory extends Factory { } } + public static DataType createPrimitive(String type, String value) { + switch (type) { + case "boolean": return new BooleanType(value); + case "integer": return new IntegerType(value); + case "integer64": return new Integer64Type(value); + case "string": return new StringType(value); + case "decimal": return new DecimalType(value); + case "uri": return new UriType(value); + case "url": return new UrlType(value); + case "canonical": return new CanonicalType(value); + case "base64Binary": return new Base64BinaryType(value); + case "instant": return new InstantType(value); + case "date": return new DateType(value); + case "dateTime": return new DateTimeType(value); + case "time": return new TimeType(value); + case "code": return new CodeType(value); + case "oid": return new OidType(value); + case "id": return new IdType(value); + case "markdown": return new MarkdownType(value); + case "unsignedInt": return new UnsignedIntType(value); + case "positiveInt": return new PositiveIntType(value); + case "uuid": return new UuidType(value); + default: + throw new FHIRException("Unknown Primitive Type '"+type+"'"); + } + } + } \ No newline at end of file