opennlp.uima.util
Class CasConsumerUtil

java.lang.Object
  extended by opennlp.uima.util.CasConsumerUtil

public final class CasConsumerUtil
extends Object

This is a util class for cas consumer.


Method Summary
static void checkFeatureType(org.apache.uima.cas.Feature feature, String expectedType)
          Checks if the given feature has the expected type otherwise an exception is thrown.
static opennlp.tools.dictionary.Dictionary createOptionalDictionary(org.apache.uima.UimaContext context, String parameter)
           
static Boolean getOptionalBooleanParameter(org.apache.uima.UimaContext context, String parameter)
          Retrieves an optional boolean parameter from the given context.
static Float getOptionalFloatParameter(org.apache.uima.UimaContext context, String parameter)
          Retrieves an optional boolean parameter from the given context.
static Integer getOptionalIntegerParameter(org.apache.uima.UimaContext context, String parameter)
          Retrieves an optional boolean parameter from the given context.
static Integer getOptionalIntegerParameter(org.apache.uima.UimaContext context, String parameter, int defaultValue)
          Retrieves an optional boolean parameter from the given context.
static InputStream getOptionalResourceAsStream(org.apache.uima.UimaContext context, String name)
           
static String[] getOptionalStringArrayParameter(org.apache.uima.UimaContext context, String parameter)
           
static String getOptionalStringParameter(org.apache.uima.UimaContext context, String parameter)
          Retrieves an optional boolean parameter from the given context.
static org.apache.uima.cas.Type getOptionalType(org.apache.uima.cas.TypeSystem typeSystem, String name)
          Retrieves a type from the given type system.
static Boolean getRequiredBooleanParameter(org.apache.uima.UimaContext context, String parameter)
          Retrieves a required boolean parameter from the given context.
static Float getRequiredFloatParameter(org.apache.uima.UimaContext context, String parameter)
          Retrieves a required parameter form the given context.
static Integer getRequiredIntegerParameter(org.apache.uima.UimaContext context, String parameter)
          Retrieves a required parameter form the given context.
static String getRequiredStringParameter(org.apache.uima.UimaContext context, String parameter)
          Retrieves a required parameter form the given context.
static InputStream getResourceAsStream(org.apache.uima.UimaContext context, String name)
          Retrieves a resource as stream from the given context.
static org.apache.uima.cas.Type getType(org.apache.uima.cas.TypeSystem typeSystem, String name)
          Retrieves a type from the given type system.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getOptionalResourceAsStream

public static InputStream getOptionalResourceAsStream(org.apache.uima.UimaContext context,
                                                      String name)
                                               throws org.apache.uima.resource.ResourceInitializationException
Throws:
org.apache.uima.resource.ResourceInitializationException

getResourceAsStream

public static InputStream getResourceAsStream(org.apache.uima.UimaContext context,
                                              String name)
                                       throws org.apache.uima.resource.ResourceInitializationException
Retrieves a resource as stream from the given context.

Parameters:
context -
name -
Returns:
the stream
Throws:
org.apache.uima.analysis_engine.annotator.AnnotatorConfigurationException
org.apache.uima.resource.ResourceInitializationException

getType

public static org.apache.uima.cas.Type getType(org.apache.uima.cas.TypeSystem typeSystem,
                                               String name)
                                        throws org.apache.uima.resource.ResourceInitializationException
Retrieves a type from the given type system.

Parameters:
typeSystem -
name -
Returns:
the type
Throws:
org.apache.uima.resource.ResourceInitializationException

getOptionalType

public static org.apache.uima.cas.Type getOptionalType(org.apache.uima.cas.TypeSystem typeSystem,
                                                       String name)
                                                throws org.apache.uima.resource.ResourceInitializationException
Retrieves a type from the given type system.

Parameters:
typeSystem -
name -
Returns:
the type
Throws:
org.apache.uima.resource.ResourceInitializationException

getRequiredStringParameter

public static String getRequiredStringParameter(org.apache.uima.UimaContext context,
                                                String parameter)
                                         throws org.apache.uima.resource.ResourceInitializationException
Retrieves a required parameter form the given context.

Parameters:
context -
parameter -
Returns:
the parameter
Throws:
org.apache.uima.resource.ResourceInitializationException

getRequiredIntegerParameter

public static Integer getRequiredIntegerParameter(org.apache.uima.UimaContext context,
                                                  String parameter)
                                           throws org.apache.uima.resource.ResourceInitializationException
Retrieves a required parameter form the given context.

Parameters:
context -
parameter -
Returns:
the parameter
Throws:
org.apache.uima.resource.ResourceInitializationException

getRequiredFloatParameter

public static Float getRequiredFloatParameter(org.apache.uima.UimaContext context,
                                              String parameter)
                                       throws org.apache.uima.resource.ResourceInitializationException
Retrieves a required parameter form the given context.

Parameters:
context -
parameter -
Returns:
the parameter
Throws:
org.apache.uima.resource.ResourceInitializationException

getRequiredBooleanParameter

public static Boolean getRequiredBooleanParameter(org.apache.uima.UimaContext context,
                                                  String parameter)
                                           throws org.apache.uima.resource.ResourceInitializationException
Retrieves a required boolean parameter from the given context.

Parameters:
context -
parameter -
Returns:
the boolean parameter
Throws:
org.apache.uima.resource.ResourceInitializationException

getOptionalStringParameter

public static String getOptionalStringParameter(org.apache.uima.UimaContext context,
                                                String parameter)
                                         throws org.apache.uima.resource.ResourceInitializationException
Retrieves an optional boolean parameter from the given context.

Parameters:
context -
parameter -
Returns:
the boolean parameter or null if not set
Throws:
org.apache.uima.resource.ResourceInitializationException

getOptionalStringArrayParameter

public static String[] getOptionalStringArrayParameter(org.apache.uima.UimaContext context,
                                                       String parameter)
                                                throws org.apache.uima.resource.ResourceInitializationException
Throws:
org.apache.uima.resource.ResourceInitializationException

getOptionalIntegerParameter

public static Integer getOptionalIntegerParameter(org.apache.uima.UimaContext context,
                                                  String parameter)
                                           throws org.apache.uima.resource.ResourceInitializationException
Retrieves an optional boolean parameter from the given context.

Parameters:
context -
parameter -
Returns:
the boolean parameter or null if not set
Throws:
org.apache.uima.resource.ResourceInitializationException

getOptionalIntegerParameter

public static Integer getOptionalIntegerParameter(org.apache.uima.UimaContext context,
                                                  String parameter,
                                                  int defaultValue)
                                           throws org.apache.uima.resource.ResourceInitializationException
Retrieves an optional boolean parameter from the given context.

Parameters:
context -
parameter -
defaultValue - value to use if the optional parameter is not set
Returns:
the boolean parameter or null if not set
Throws:
org.apache.uima.resource.ResourceInitializationException

getOptionalFloatParameter

public static Float getOptionalFloatParameter(org.apache.uima.UimaContext context,
                                              String parameter)
                                       throws org.apache.uima.resource.ResourceInitializationException
Retrieves an optional boolean parameter from the given context.

Parameters:
context -
parameter -
Returns:
the boolean parameter or null if not set
Throws:
org.apache.uima.resource.ResourceInitializationException

getOptionalBooleanParameter

public static Boolean getOptionalBooleanParameter(org.apache.uima.UimaContext context,
                                                  String parameter)
                                           throws org.apache.uima.resource.ResourceInitializationException
Retrieves an optional boolean parameter from the given context.

Parameters:
context -
parameter -
Returns:
the boolean parameter or null if not set
Throws:
org.apache.uima.resource.ResourceInitializationException

checkFeatureType

public static void checkFeatureType(org.apache.uima.cas.Feature feature,
                                    String expectedType)
                             throws org.apache.uima.resource.ResourceInitializationException
Checks if the given feature has the expected type otherwise an exception is thrown.

Parameters:
feature -
expectedType -
Throws:
org.apache.uima.resource.ResourceInitializationException - - if type does not match

createOptionalDictionary

public static opennlp.tools.dictionary.Dictionary createOptionalDictionary(org.apache.uima.UimaContext context,
                                                                           String parameter)
                                                                    throws org.apache.uima.resource.ResourceInitializationException
Throws:
org.apache.uima.resource.ResourceInitializationException


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.