You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Richard Eckart de Castilho (Jira)" <de...@uima.apache.org> on 2021/09/15 07:35:00 UTC

[jira] [Created] (UIMA-6382) Better alternative for CasCreationUtils

Richard Eckart de Castilho created UIMA-6382:
------------------------------------------------

             Summary: Better alternative for CasCreationUtils
                 Key: UIMA-6382
                 URL: https://issues.apache.org/jira/browse/UIMA-6382
             Project: UIMA
          Issue Type: New Feature
          Components: Core Java Framework
            Reporter: Richard Eckart de Castilho


The {{CasCreationUtils}} class is the way of creating new CAS instances, but its signatures are becoming a bit unwieldy. E.g. we have a {{CasCreationUtils.createCas()}} to create a CAS without any type system definition and we have a {{CasCreationUtils.createCas(tsd, null, null, null)}} to create one with a type system definition and nothing really in between.

In would propose investigating a builder-like approach where we could write something like:

```
CAS cas = CAS.builder().withTypeSystem(tsd).build();

CAS cas = CAS.builder()
   .withDefinition(CasDefinition)
   .withTypeSystem(tsd)
   .withTypePriorities(...)
   .withFsIndexes(...)
   .addAnalysisEngineDescription(...) // can be called multiple times
   .addMetaDataObject(...) // can be called multiple times
   .withResourceManager(...)
   .withProperties(...)
   .withProperty(...)
   .build();
```



--
This message was sent by Atlassian Jira
(v8.3.4#803005)