Uploaded image for project: 'UIMA'
  1. UIMA
  2. UIMA-6382

Better alternative for CasCreationUtils

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • Core Java Framework
    • 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();
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            rec Richard Eckart de Castilho
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: