You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2022/04/08 13:57:07 UTC

[uima-uimafit] branch feature/UIMA-6431-Use-lambda-functions-as-CAS-processors created (now 07d3432)

This is an automated email from the ASF dual-hosted git repository.

rec pushed a change to branch feature/UIMA-6431-Use-lambda-functions-as-CAS-processors
in repository https://gitbox.apache.org/repos/asf/uima-uimafit.git


      at 07d3432  [UIMA-6431] Use lambda functions as CAS processors

This branch includes the following new commits:

     new 07d3432  [UIMA-6431] Use lambda functions as CAS processors

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[uima-uimafit] 01/01: [UIMA-6431] Use lambda functions as CAS processors

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch feature/UIMA-6431-Use-lambda-functions-as-CAS-processors
in repository https://gitbox.apache.org/repos/asf/uima-uimafit.git

commit 07d3432db5a13ecbef1ae3296396ab36d3e23323
Author: Richard Eckart de Castilho <re...@apache.org>
AuthorDate: Fri Apr 8 15:57:02 2022 +0200

    [UIMA-6431] Use lambda functions as CAS processors
    
    - Added factory methods for functional (J)CAS processors to the AnalysisEngineFactory
---
 .../uima/fit/factory/AnalysisEngineFactory.java    | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/uimafit-core/src/main/java/org/apache/uima/fit/factory/AnalysisEngineFactory.java b/uimafit-core/src/main/java/org/apache/uima/fit/factory/AnalysisEngineFactory.java
index de0fe5a..7353d2d 100644
--- a/uimafit-core/src/main/java/org/apache/uima/fit/factory/AnalysisEngineFactory.java
+++ b/uimafit-core/src/main/java/org/apache/uima/fit/factory/AnalysisEngineFactory.java
@@ -43,6 +43,10 @@ import java.util.Map.Entry;
 import org.apache.uima.Constants;
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.analysis_component.AnalysisComponent;
+import org.apache.uima.analysis_component.CasProcessor;
+import org.apache.uima.analysis_component.CasProcessorAnnotator;
+import org.apache.uima.analysis_component.JCasProcessor;
+import org.apache.uima.analysis_component.JCasProcessorAnnotator;
 import org.apache.uima.analysis_engine.AnalysisEngine;
 import org.apache.uima.analysis_engine.AnalysisEngineDescription;
 import org.apache.uima.analysis_engine.impl.AggregateAnalysisEngine_impl;
@@ -1799,4 +1803,34 @@ public final class AnalysisEngineFactory {
     return createEngineDescription(analysisEngineDescriptions, componentNames, typePriorities,
             sofaMappings, flowControllerDescription);
   }
+
+    /**
+     * Create an analysis engine from a processor function.
+     * 
+     * @param aJCasAnnotator
+     *            the processor function.
+     * @return the ready-to-use analysis engine
+     * @throws ResourceInitializationException
+     *             of there was a problem creating the engine.
+     */
+    public static AnalysisEngine createEngine(JCasProcessor<? extends Exception> aJCasAnnotator)
+        throws ResourceInitializationException
+    {
+        return JCasProcessorAnnotator.of(aJCasAnnotator);
+    }
+
+    /**
+     * Create an analysis engine from a processor function.
+     * 
+     * @param aCasAnnotator
+     *            the processor function.
+     * @return the ready-to-use analysis engine
+     * @throws ResourceInitializationException
+     *             of there was a problem creating the engine.
+     */
+    public static AnalysisEngine createEngine(CasProcessor<? extends Exception> aCasAnnotator)
+        throws ResourceInitializationException
+    {
+        return CasProcessorAnnotator.of(aCasAnnotator);
+    }
 }