importance/usages of getAllPopulatedChildElementsOfType

59 views
Skip to first unread message

allanbr...@gmail.com

unread,
Jan 31, 2017, 5:03:54 AM1/31/17
to HAPI FHIR
Hi
We have developed a FHIR-server with many resources. Some of our resources does extend a FHIR-resource (e.g. Location) others are base ressources (and extend ca.uhn.fhir.model.dstu2.resource.BaseResource).
We use DSTU2 and Hapi 2.2.

I am doing a general walk-through and notice that sometimes we have overridden getAllPopulatedChildElementsOfType (inherited from ICompositeElement), sometimes we haven't.

/**
* Returns a list containing all child elements matching a given type
*
* @param theType The type to match. If set to null, all child elements will be returned
*/
<T extends IElement>
List<T> getAllPopulatedChildElementsOfType(Class<T> theType);


What is the hapi-usage of this (our own code doesn't use it) - do we need to implement it?
The implementation guide at http://hapifhir.io/doc_extensions.html does not mention it, but it seems quite natural to override it.

James Agnew

unread,
Jan 31, 2017, 6:45:58 AM1/31/17
to allanbr...@gmail.com, HAPI FHIR
HI Allan,

This is a good observation, that method isn't called by any of HAPI's internals at this point so there will be no effect if you don't implement it or call it.

In the early days of HAPI it was used by the Parser as an optimization when encoding resources, but profiling revealed that it didn't actually help so we stopped using it, and the STU3 structures have done away with it entirely.

I'm going to mark that method as deprecated (not sure why it wasn't already) and add some more descriptive javadoc about this.

Note that "isEmpty()" does get used for the same optimisation, so that method is important to override.

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+unsubscribe@googlegroups.com.
To post to this group, send email to hapi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/c2ba1b7e-8efa-4df0-83ad-fbdc061dbe32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

allanbr...@gmail.com

unread,
Jan 31, 2017, 7:11:03 AM1/31/17
to HAPI FHIR, allanbr...@gmail.com
Hi James

Thx, a perfect answer for me :-)

Br Allan
Reply all
Reply to author
Forward
0 new messages