Interface ComponentRoot

  • All Known Subinterfaces:
    EfestoComponentRoot
    All Known Implementing Classes:
    EfestoAppRoot

    public interface ComponentRoot
    Root path of a component.

    Each component should implement their root and provide a method of the form:

       IdSubclass get(Params...)
     

    The reason why there is no method in the interface is to allow implementors to define a get() method with as many parameters as desired, with the most appropriate types

    e.g. these are all allowed

       public RuleUnitId get(Class ruleUnitDefinition)
       public RuleUnitId get(String canonicalName)
       public DecisionId get(String namespace, String name)
       etc...
     

    A get() method should however always

    • return a LocalId (or, sometimes an Id or a RemoteId may be appropriate).
    • expect one or more parameters; these parameters must be used to construct the identifier and, ideally, should appear somehow in the identifier (or at least, it should be possible to map the identifier back on the originating parameters)

    While component writers are expected to adhere to such rules, they may otherwise choose to design these getters as they prefer.

    The returned identifier should always be prefixed by the ComponentRoot prefix.

    e.g. ProcessIds would start with /processes, DecisionIds would start with /decisions, etc.

    ComponentRoots may be addressable directly; however, it is preferred to use them through some other interface.

    e.g.:

       @Inject AppRoot appRoot;
       // ...
       var id = appRoot.get(ProcessIds.class).get("my-process-id)
     
       @Inject ProcessIds processIds;
       // ...
       var id = processIds.get("my-process-id)