fixes for #483: Quantity subclasses copy() functions not all transferring values

This commit is contained in:
Grahame Grieve 2021-05-04 12:43:07 +10:00
parent 53ea22cae7
commit 898665f356
6 changed files with 681 additions and 669 deletions

View File

@ -115,6 +115,12 @@ public class Money extends Quantity implements ICompositeType {
public Money copy() {
Money dst = new Money();
copyValues(dst);
dst.value = value == null ? null : value.copy();
dst.comparator = comparator == null ? null : comparator.copy();
dst.unit = unit == null ? null : unit.copy();
dst.system = system == null ? null : system.copy();
dst.code = code == null ? null : code.copy();
return dst;
}

View File

@ -54,11 +54,6 @@ public class MoneyQuantity extends Quantity {
public void copyValues(MoneyQuantity dst) {
super.copyValues(dst);
dst.value = value == null ? null : value.copy();
dst.comparator = comparator == null ? null : comparator.copy();
dst.unit = unit == null ? null : unit.copy();
dst.system = system == null ? null : system.copy();
dst.code = code == null ? null : code.copy();
}
protected MoneyQuantity typedCopy() {

View File

@ -54,11 +54,6 @@ public class SimpleQuantity extends Quantity {
public void copyValues(SimpleQuantity dst) {
super.copyValues(dst);
dst.value = value == null ? null : value.copy();
dst.comparator = comparator == null ? null : comparator.copy();
dst.unit = unit == null ? null : unit.copy();
dst.system = system == null ? null : system.copy();
dst.code = code == null ? null : code.copy();
}
protected SimpleQuantity typedCopy() {

View File

@ -53,11 +53,6 @@ public class MoneyQuantity extends Quantity {
public void copyValues(MoneyQuantity dst) {
super.copyValues(dst);
dst.value = value == null ? null : value.copy();
dst.comparator = comparator == null ? null : comparator.copy();
dst.unit = unit == null ? null : unit.copy();
dst.system = system == null ? null : system.copy();
dst.code = code == null ? null : code.copy();
}
protected MoneyQuantity typedCopy() {

View File

@ -684,5 +684,31 @@ 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+"'");
}
}
}

View File

@ -53,11 +53,6 @@ public class SimpleQuantity extends Quantity {
public void copyValues(SimpleQuantity dst) {
super.copyValues(dst);
dst.value = value == null ? null : value.copy();
dst.comparator = comparator == null ? null : comparator.copy();
dst.unit = unit == null ? null : unit.copy();
dst.system = system == null ? null : system.copy();
dst.code = code == null ? null : code.copy();
}
protected SimpleQuantity typedCopy() {