Merge pull request #259 from nrpeterson/boundcodeableconcept-serialization
Add serializability for BoundCodeableConceptDt
This commit is contained in:
commit
a046afe1d0
|
@ -20,6 +20,8 @@ package ca.uhn.fhir.model.api;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
public interface IBoundCodeableConcept {
|
||||
import java.io.Serializable;
|
||||
|
||||
public interface IBoundCodeableConcept extends Serializable {
|
||||
|
||||
}
|
||||
|
|
|
@ -21,8 +21,9 @@ package ca.uhn.fhir.model.api;
|
|||
*/
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public interface IValueSetEnumBinder<T extends Enum<?>> {
|
||||
public interface IValueSetEnumBinder<T extends Enum<?>> extends Serializable {
|
||||
|
||||
T fromCodeString(String theCodeString);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import ca.uhn.fhir.model.dstu2.composite.AddressDt;
|
|||
import ca.uhn.fhir.model.dstu2.composite.HumanNameDt;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.MaritalStatusCodesEnum;
|
||||
import ca.uhn.fhir.parser.IParser;
|
||||
|
||||
public class ModelSerializationTest {
|
||||
|
@ -55,4 +56,19 @@ public class ModelSerializationTest {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that MaritalStatusCodeEnum (and, by extension, BoundCodeableConcepts in general) are serializable.
|
||||
* Author: Nick Peterson (nrpeterson@gmail.com)
|
||||
*/
|
||||
@Test
|
||||
public void testBoundCodeableConceptSerialization() {
|
||||
MaritalStatusCodesEnum maritalStatus = MaritalStatusCodesEnum.M;
|
||||
byte[] bytes = SerializationUtils.serialize(maritalStatus);
|
||||
assertTrue(bytes.length > 0);
|
||||
|
||||
MaritalStatusCodesEnum deserialized = SerializationUtils.deserialize(bytes);
|
||||
assertEquals(maritalStatus.getCode(), deserialized.getCode());
|
||||
assertEquals(maritalStatus.getSystem(), deserialized.getSystem());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue