FHIR Chat · Java item[x]: avoiding returning null · committers

Stream: committers

Topic: Java item[x]: avoiding returning null


view this post on Zulip 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.

view this post on Zulip Grahame Grieve (Oct 10 2018 at 18:52):

@James Agnew do you agree?

view this post on Zulip 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.

view this post on Zulip Grahame Grieve (Oct 10 2018 at 18:57):

yes that already happens. I'll make the change now

view this post on Zulip Grahame Grieve (Oct 10 2018 at 18:57):

I'm about to regenerate them all anyway

view this post on Zulip Grahame Grieve (Oct 10 2018 at 18:57):

The R4 ones, anyway

view this post on Zulip 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.

view this post on Zulip Patrick Werner (Oct 10 2018 at 19:02):

DSTU2 for the correction to http://hl7.org/fhir/StructureDefinition/RESOURCE_NAMEas well (i assume nobody uses DSTU1 anymore)

view this post on Zulip Grahame Grieve (Oct 10 2018 at 19:03):

better make a gForge task to regenerate them. That's harder work....

view this post on Zulip Patrick Werner (Oct 10 2018 at 19:04):

:thumbs_up:

view this post on Zulip Patrick Werner (Oct 10 2018 at 19:04):

i'll do


Last updated: Apr 12 2022 at 19:14 UTC