opennlp.uima.util
Class CasConsumerUtil

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

public final class CasConsumerUtil
extends java.lang.Object

This is a util class for cas consumer.


Method Summary
static void checkFeatureType(org.apache.uima.cas.Feature feature, java.lang.String expectedType)
          Checks if the given feature has the expected type otherwise an exception is thrown.
static Dictionary createOptionalDictionary(org.apache.uima.UimaContext context, java.lang.String parameter)
           
static java.lang.Boolean getOptionalBooleanParameter(org.apache.uima.UimaContext context, java.lang.String parameter)
          Retrieves an optional boolean parameter from the given context.
static java.lang.Float getOptionalFloatParameter(org.apache.uima.UimaContext context, java.lang.String parameter)
          Retrieves an optional boolean parameter from the given context.
static java.lang.Integer getOptionalIntegerParameter(org.apache.uima.UimaContext context, java.lang.String parameter)
          Retrieves an optional boolean parameter from the given context.
static java.lang.Integer getOptionalIntegerParameter(org.apache.uima.UimaContext context, java.lang.String parameter, int defaultValue)
          Retrieves an optional boolean parameter from the given context.
static java.io.InputStream getOptionalResourceAsStream(org.apache.uima.UimaContext context, java.lang.String name)
           
static java.lang.String[] getOptionalStringArrayParameter(org.apache.uima.UimaContext context, java.lang.String parameter)
           
static java.lang.String getOptionalStringParameter(org.apache.uima.UimaContext context, java.lang.String parameter)
          Retrieves an optional boolean parameter from the given context.
static org.apache.uima.cas.Type getOptionalType(org.apache.uima.cas.TypeSystem typeSystem, java.lang.String name)
          Retrieves a type from the given type system.
static java.lang.Boolean getRequiredBooleanParameter(org.apache.uima.UimaContext context, java.lang.String parameter)
          Retrieves a required boolean parameter from the given context.
static java.lang.Float getRequiredFloatParameter(org.apache.uima.UimaContext context, java.lang.String parameter)
          Retrieves a required parameter form the given context.
static java.lang.Integer getRequiredIntegerParameter(org.apache.uima.UimaContext context, java.lang.String parameter)
          Retrieves a required parameter form the given context.
static java.lang.String getRequiredStringParameter(org.apache.uima.UimaContext context, java.lang.String parameter)
          Retrieves a required parameter form the given context.
static java.io.InputStream getResourceAsStream(org.apache.uima.UimaContext context, java.lang.String name)
          Retrieves a resource as stream from the given context.
static org.apache.uima.cas.Type getType(org.apache.uima.cas.TypeSystem typeSystem, java.lang.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 java.io.InputStream getOptionalResourceAsStream(org.apache.uima.UimaContext context,
                                                              java.lang.String name)
                                                       throws org.apache.uima.resource.ResourceInitializationException
Throws:
org.apache.uima.resource.ResourceInitializationException

getResourceAsStream

public static java.io.InputStream getResourceAsStream(org.apache.uima.UimaContext context,
                                                      java.lang.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,
                                               java.lang.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,
                                                       java.lang.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 java.lang.String getRequiredStringParameter(org.apache.uima.UimaContext context,
                                                          java.lang.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 java.lang.Integer getRequiredIntegerParameter(org.apache.uima.UimaContext context,
                                                            java.lang.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 java.lang.Float getRequiredFloatParameter(org.apache.uima.UimaContext context,
                                                        java.lang.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 java.lang.Boolean getRequiredBooleanParameter(org.apache.uima.UimaContext context,
                                                            java.lang.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 java.lang.String getOptionalStringParameter(org.apache.uima.UimaContext context,
                                                          java.lang.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 java.lang.String[] getOptionalStringArrayParameter(org.apache.uima.UimaContext context,
                                                                 java.lang.String parameter)
                                                          throws org.apache.uima.resource.ResourceInitializationException
Throws:
org.apache.uima.resource.ResourceInitializationException

getOptionalIntegerParameter

public static java.lang.Integer getOptionalIntegerParameter(org.apache.uima.UimaContext context,
                                                            java.lang.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 java.lang.Integer getOptionalIntegerParameter(org.apache.uima.UimaContext context,
                                                            java.lang.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 java.lang.Float getOptionalFloatParameter(org.apache.uima.UimaContext context,
                                                        java.lang.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 java.lang.Boolean getOptionalBooleanParameter(org.apache.uima.UimaContext context,
                                                            java.lang.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,
                                    java.lang.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 Dictionary createOptionalDictionary(org.apache.uima.UimaContext context,
                                                  java.lang.String parameter)
                                           throws org.apache.uima.resource.ResourceInitializationException
Throws:
org.apache.uima.resource.ResourceInitializationException


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