Class CommonResourceSupertypeScanner


  • public class CommonResourceSupertypeScanner
    extends Object
     When populating the StructureDefinition links in a capability statement,
     it can be useful to know the lowest common superclass for the profiles in use for a given resource name.
     This class finds this superclass, by incrementally computing the greatest common sequence of ancestor classes in the class hierarchies of registered resources.
     For instance, given the following classes
     MyPatient extends Patient
     MyPatient2 extends MyPatient
     MyPatient3 extends MyPatient
     MyPatient4 extends MyPatient3
     this class will find the common ancestor sequence "IBaseResource -> Patient -> MyPatient". MyPatient is the lowest common superclass in this hierarchy.
     
    • Method Detail

      • register

        public void register​(Class<? extends org.hl7.fhir.instance.model.api.IBaseResource> resourceClass)
        Recomputes the lowest common superclass by adding a new resource definition to the hierarchy.
        Parameters:
        resourceClass - The resource class to add.
      • getLowestCommonSuperclass

        public Optional<Class<? extends org.hl7.fhir.instance.model.api.IBaseResource>> getLowestCommonSuperclass()
        Returns:
        The lowest common superclass of currently registered resources.