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

JCasUtil methods could be more generic

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 2.2.0uimaFIT
    • uimaFIT
    • None

    Description

      As an example, the method indexCovering of JCasUtil has signature:

      public static <T extends Annotation,S extends Annotation> Map<T, Collection<S>> indexCovering(
        JCas jCas,
        Class<T> type,
        Class<S> coveringType)
      

      With this signature, the following code is invalid (RevisedSentence is a subclass of Sentence):

      Map<RevisedWords, Collection<Sentence>> indexRevised
                      = JCasUtil.indexCovering(
                              revised,
                              RevisedWords.class,
                              RevisedSentence.class);
      

      This somewhat prevents users of JCasUtil from benefiting of all the OOP pluses of the UIMA TS.

      Here would be a signature that would maybe better fit the problem:

      public static <T extends Annotation, S extends Annotation> Map<T, Collection<S>> indexCovering(
        JCas jCas,
        Class<? extends T> type,
        Class<? extends S> coveringType)
      

      Attachments

        Activity

          People

            rec Richard Eckart de Castilho
            m09 Hugo Mougard
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: