Added the copying of "extension" fiels

This commit is contained in:
palanm 2021-02-16 17:27:53 -08:00
parent c422ddc388
commit c8fa589baa
2 changed files with 116 additions and 100 deletions

View File

@ -34,6 +34,7 @@ package org.hl7.fhir.r4.model;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.ArrayList;
import org.hl7.fhir.instance.model.api.IBaseEnumeration;
@ -119,7 +120,14 @@ public class Enumeration<T extends Enum<?>> extends PrimitiveType<T> implements
@Override
public Enumeration<T> copy() {
return new Enumeration<T>(myEnumFactory, getValue());
Enumeration dst= new Enumeration(this.myEnumFactory, (Enum)this.getValue());
//Copy the Extension
if (extension != null) {
dst.extension = new ArrayList();
for (Extension i : extension)
dst.extension.add(i.copy());
};
return dst;
}
@Override

View File

@ -34,6 +34,7 @@ package org.hl7.fhir.r5.model;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.ArrayList;
import org.hl7.fhir.instance.model.api.IBaseEnumeration;
@ -119,7 +120,14 @@ public class Enumeration<T extends Enum<?>> extends PrimitiveType<T> implements
@Override
public Enumeration<T> copy() {
return new Enumeration<T>(myEnumFactory, getValue());
Enumeration dst= new Enumeration(this.myEnumFactory, (Enum)this.getValue());
//Copy the Extension
if (extension != null) {
dst.extension = new ArrayList();
for (Extension i : extension)
dst.extension.add(i.copy());
};
return dst;
}
@Override