org.apache.uima.fit.component

## Class ViewCreatorAnnotator

- java.lang.Object
- - org.apache.uima.analysis_component.AnalysisComponent_ImplBase
  - - org.apache.uima.analysis_component.Annotator_ImplBase
    - - org.apache.uima.analysis_component.JCasAnnotator_ImplBase
      - - org.apache.uima.fit.component.JCasAnnotator_ImplBase
        - - org.apache.uima.fit.component.ViewCreatorAnnotator

- All Implemented Interfaces:
    AnalysisComponent

      public class ViewCreatorAnnotator
      extends JCasAnnotator_ImplBase

  This annotator can be placed at/near the beginning of a pipeline to ensure that a particular view is created before it is used further downstream. It will create a view for the view name specified by the configuration parameter PARAM_VIEW_NAME if it doesn't exist. One place this is useful is if you are using an annotator that uses the default view and you have mapped the default view into a different view via a sofa mapping. The default view is created automatically - but if you have mapped the default view to some other view, then the view provided to your annotator (when it asks for the default view) will not be created unless you have explicitly created it.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `PARAM_VIEW_NAME` The parameter name for the name of the viewed to be created by this annotator

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ViewCreatorAnnotator()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static JCas` | `createViewSafely(JCas aJCas, String aViewName)` Provides a simple call that allows you to safely create a view if it has not been created yet.
    `void` | `process(JCas aJCas)`

    - ### Methods inherited from class org.apache.uima.fit.component.JCasAnnotator_ImplBase

      `initialize`

    - ### Methods inherited from class org.apache.uima.analysis_component.JCasAnnotator_ImplBase

      `getRequiredCasInterface, process`

    - ### Methods inherited from class org.apache.uima.analysis_component.Annotator_ImplBase

      `getCasInstancesRequired, hasNext, next`

    - ### Methods inherited from class org.apache.uima.analysis_component.AnalysisComponent_ImplBase

      `batchProcessComplete, collectionProcessComplete, destroy, getContext, getLogger, getResultSpecification, reconfigure, setResultSpecification`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### PARAM_VIEW_NAME

          public static final String PARAM_VIEW_NAME

      The parameter name for the name of the viewed to be created by this annotator
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ViewCreatorAnnotator

          public ViewCreatorAnnotator()

  - ### Method Detail

    - #### process

          public void process(JCas aJCas)
                       throws AnalysisEngineProcessException

      Specified by:
        `process` in class `JCasAnnotator_ImplBase`
      Throws:
        `AnalysisEngineProcessException`

    - #### createViewSafely

          public static JCas createViewSafely(JCas aJCas,
                                              String aViewName)
                                       throws AnalysisEngineProcessException

      Provides a simple call that allows you to safely create a view if it has not been created yet. If the view already exists, it is ok to call this method anyways without worrying about checking for this yet.
      Parameters:
        `aJCas` - the `JCas` to create the view in
        `aViewName` - the name of the new view
      Returns:
        true if the view was created as a result of calling this method. false if the view already existed.
      Throws:
        `AnalysisEngineProcessException` - if the view could not be created or if an existing view with the given name could not be accessed

Copyright © 2012–2021 The Apache Software Foundation. All rights reserved.