diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IBoundCodeableConcept.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IBoundCodeableConcept.java index 756f565fd00..dc80e5108da 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IBoundCodeableConcept.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IBoundCodeableConcept.java @@ -20,6 +20,8 @@ package ca.uhn.fhir.model.api; * #L% */ -public interface IBoundCodeableConcept { +import java.io.Serializable; + +public interface IBoundCodeableConcept extends Serializable { } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IValueSetEnumBinder.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IValueSetEnumBinder.java index 48b1246818e..a82297c6eef 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IValueSetEnumBinder.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IValueSetEnumBinder.java @@ -21,8 +21,9 @@ package ca.uhn.fhir.model.api; */ +import java.io.Serializable; -public interface IValueSetEnumBinder> { +public interface IValueSetEnumBinder> extends Serializable { T fromCodeString(String theCodeString); diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/ModelSerializationTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/ModelSerializationTest.java index 340fd2371c3..16534773a10 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/ModelSerializationTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/dstu2/ModelSerializationTest.java @@ -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()); + } + }