reckart opened a new issue, #429:
URL: https://github.com/apache/uima-uimaj/issues/429

   **Is your feature request related to a problem? Please describe.**
   We have the `createEngineDescription` and friends methods in uimaFIT. 
However, their parameters can be a bit confusing. For simple cases, we have a 
class and then the parameter/value combinations as pairs. However, if we want 
to add in a type system, type priorities or other stuff, it either becomes a 
bit fragile to not accidentally intermix those with the parameters or it is 
plain to possible because no `createEngineDescription` signature with the 
respective item exists.
   
   **Describe the solution you'd like**
   It would be nice to have a builder which would allow stuff like this:
   
   ```
   var engineDescription = 
AnalysisEngineDescription.builder(MyAnalsisEngine.class) //
       
.withTypeSystem(TypeSystemDescriptionFactory.createTypeSystemDescription()) // 
can probably be omitted in most cases
       .withParameter(MyAnalsisEngine.PARAM_BLAH, "blub") // single parameter
       .withParameters( // multiples as pairs because it is convenient to not 
have to repeat "withParameter" all the time
            MyAnalsisEngine.PARAM_FOO, "foo", //
            MyAnalsisEngine.PARAM_BAR, "bar")
       .withTypePriorities(...) //
       .build();
   ```
   
   **Describe alternatives you've considered**
   Instead of a normal builder pattern, a customizer pattern could also be 
used. That might make working with nested elements in the description more 
convenient. E.g.
   
   ```
   var engineDescription = 
AnalysisEngineDescription.builder(MyAnalsisEngine.class).customize(engine -> { 
//
       engine.metadata(md -> { //
           md.name("My Analysis Engine");
           md.vendor("ACME"); //
           
md.typeSystem(TypeSystemDescriptionFactory.createTypeSystemDescription());
       });
       engine.parameters(params -> { //
           params.set(MyAnalsisEngine.PARAM_FOO, "foo");
           params.set(MyAnalsisEngine.PARAM_BAR, "bar");
       })
   }) //
   .build();
   ```
   
   **Additional context**
   Important: the new approach should **not** auto-scan for type system 
descriptions or similar metadata. Scanning can be slow in certain environments 
and doing that for every analysis engine etc. is not necesssary. If a CAS needs 
to be created with a scanned type system, `CasFactory.createCas()` should be 
used. It is sufficient if the CAS knows the type system. It is should not be 
necessary for each and every component to know it (unless you build a pipeline 
from a bunch of components that each come with their own local partial type 
system which then needs to be merged into the pipeline system).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@uima.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to