[
https://issues.apache.org/jira/browse/UIMA-6382?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Richard Eckart de Castilho updated UIMA-6382:
---------------------------------------------
Description:
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:
{code}
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();
{code}
was:
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();
```
> 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
> Priority: Minor
>
> 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:
> {code}
> 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();
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)