use of org.hl7.fhir.dstu2.model.StringType in project org.hl7.fhir.core by hapifhir.
the class VersionConvertorPrimitiveType10_30Test method testNullValueDstu2Primitive.
@ParameterizedTest(name = "Testing dstu2 -> dstu3 conversion of null value {0}.")
@MethodSource("dstu2PrimitiveTypes")
public <T extends PrimitiveType> void testNullValueDstu2Primitive(String classname, T obj) {
obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new StringType("A value"));
Assertions.assertNull(((org.hl7.fhir.dstu3.model.PrimitiveType) VersionConvertorFactory_10_30.convertType(obj)).getValue());
}
use of org.hl7.fhir.dstu2.model.StringType in project org.hl7.fhir.core by hapifhir.
the class VersionConvertorPrimitiveType10_50Test method testNullValueDstu2Primitive.
@ParameterizedTest(name = "Testing dstu2 -> r5 conversion of null value {0}.")
@MethodSource("dstu2PrimitiveTypes")
public <T extends PrimitiveType> void testNullValueDstu2Primitive(String classname, T obj) {
obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new StringType("A value"));
Assertions.assertNull(((org.hl7.fhir.r4.model.PrimitiveType) VersionConvertorFactory_10_40.convertType(obj)).getValue());
}
use of org.hl7.fhir.dstu2.model.StringType in project org.hl7.fhir.core by hapifhir.
the class VersionConvertorPrimitiveType30_40Test method testNullValueDstu2Primitive.
@ParameterizedTest(name = "Testing dstu3 -> r4 conversion of null value {0}.")
@MethodSource("dstu3PrimitiveTypes")
public <T extends PrimitiveType> void testNullValueDstu2Primitive(String classname, T obj) {
obj.addExtension().setUrl("http://example.com/AnyValue").setValue(new StringType("A value"));
Assertions.assertNull(((org.hl7.fhir.r4.model.PrimitiveType) VersionConvertorFactory_30_40.convertType(obj)).getValue());
}
use of org.hl7.fhir.dstu2.model.StringType in project org.hl7.fhir.core by hapifhir.
the class ExpressionAdvisor50 method handleExtension.
public void handleExtension(@Nonnull String path, @Nonnull org.hl7.fhir.r5.model.Extension src, @Nonnull org.hl7.fhir.dstu2.model.Extension tgt) {
if (src.getValue() instanceof org.hl7.fhir.r5.model.Expression) {
StringType type = new StringType();
if (src.getValue() == null) {
throw new NullPointerException("null cannot be cast to non-null type org.hl7.fhir.r5.model.Expression");
} else {
type.setValueAsString(((Expression) src.getValue()).getExpression());
tgt.setValue(type);
if (src.hasUrlElement()) {
tgt.setUrlElement(Uri10_50.convertUri(src.getUrlElement()));
}
}
} else {
throw new FHIRException("Unknown extension type passed in to custom convertor method.");
}
}
use of org.hl7.fhir.dstu2.model.StringType in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method displayHumanName.
public static String displayHumanName(HumanName name) {
StringBuilder s = new StringBuilder();
if (name.hasText())
s.append(name.getText());
else {
for (StringType p : name.getGiven()) {
s.append(p.getValue());
s.append(" ");
}
for (StringType p : name.getFamily()) {
s.append(p.getValue());
s.append(" ");
}
}
if (name.hasUse() && name.getUse() != NameUse.USUAL)
s.append("(" + name.getUse().toString() + ")");
return s.toString();
}
Aggregations