Stream: committers
Topic: Java item[x]: avoiding returning null
Patrick Werner (Oct 10 2018 at 18:44):
in: JavaResourceGenerator.java#L2284 null will be returned for item[x] : write(indent+" return null;\r\n");
This breaks using a fluent style with the Java Reference Objects (solo or inside hapi). e.g.: madication.addIngredient().getItemCodeableConcept().addCoding().setCode("M01AE01").setSystem("http://www.whocc.no/atc");
as it breaks at getItemCodeableConcept.
This could be changed to autoCreate the item element with the asked DataType if it's null, similar to the getters of single datatype elements.
Grahame Grieve (Oct 10 2018 at 18:52):
@James Agnew do you agree?
James Agnew (Oct 10 2018 at 18:57):
This has been a low-grade annoyance to me for a while. I'd support this change for sure.
The only question is what to do if you ask for getItemCodeableConcept() and there is already a value of the other type. Presumably we should throw an exception in that case.
Grahame Grieve (Oct 10 2018 at 18:57):
yes that already happens. I'll make the change now
Grahame Grieve (Oct 10 2018 at 18:57):
I'm about to regenerate them all anyway
Grahame Grieve (Oct 10 2018 at 18:57):
The R4 ones, anyway
Patrick Werner (Oct 10 2018 at 18:59):
It would be nice to regenerate DSTU3 as well. This would also fix the profile = "http://hl7.org/fhir/Profile/RESOURCE_NAME"
problem.
Patrick Werner (Oct 10 2018 at 19:02):
DSTU2 for the correction to http://hl7.org/fhir/StructureDefinition/RESOURCE_NAME
as well (i assume nobody uses DSTU1 anymore)
Grahame Grieve (Oct 10 2018 at 19:03):
better make a gForge task to regenerate them. That's harder work....
Patrick Werner (Oct 10 2018 at 19:04):
:thumbs_up:
Patrick Werner (Oct 10 2018 at 19:04):
i'll do
Last updated: Apr 12 2022 at 19:14 UTC