Details
-
New Feature
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
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:
CAS cas = CAS.builder().withTypeSystem(tsd).build(); CAS cas = CAS.builder() .withDefinition(CasDefinition) .withTypeSystem(tsd) // overrides any maybe already set type system .addTypeSystem(tsd) // can be called multiple times .withTypePriorities(...) // overrides any maybe already priorities .addTypePriorities(...) // can be called multiple times .withFsIndexes(...) // overrides any maybe already set index definitions .addFsIndexes(...) // can be called multiple times .addAnalysisEngineDescription(...) // can be called multiple times .addMetaDataObject(...) // can be called multiple times .withResourceManager(...) .withProperties(...) .withProperty(key, value) // can be called multiple times but should only be called once per key .build();