Class ConfigurationParameterInitializer

java.lang.Object
org.apache.uima.fit.component.initialize.ConfigurationParameterInitializer

public final class ConfigurationParameterInitializer extends Object
Initialize an instance of a class with fields that are annotated as ConfigurationParameters from the parameter values given in a UimaContext.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    initialize(Object component, Object... aParameters)
     
    static void
    initialize(Object component, Map<String,Object> map)
    Initialize a component from a map.
    static void
    initialize(Object component, org.apache.uima.resource.DataResource dataResource)
    Initialize a component from a ResourceMetaData.
    static void
    initialize(Object component, org.apache.uima.resource.metadata.NameValuePair... parameters)
    Initialize a component from a ResourceMetaData.
    static void
    initialize(Object component, org.apache.uima.resource.Parameter... parameters)
    Initialize a component from a CustomResourceSpecifier.
    static void
    initialize(Object component, org.apache.uima.resource.ResourceSpecifier spec)
    Initialize a component from a CustomResourceSpecifier.
    static void
    initialize(Object component, org.apache.uima.UimaContext context)
    Initialize a component from an UimaContext This code can be a little confusing because the configuration parameter annotations are used in two contexts: in describing the component and to initialize member variables from a UimaContext.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • initialize

      public static void initialize(Object component, org.apache.uima.UimaContext context) throws org.apache.uima.resource.ResourceInitializationException
      Initialize a component from an UimaContext This code can be a little confusing because the configuration parameter annotations are used in two contexts: in describing the component and to initialize member variables from a UimaContext. Here we are performing the latter task. It is important to remember that the UimaContext passed in to this method may or may not have been derived using reflection of the annotations (i.e. using ConfigurationParameterFactory via e.g. a call to a AnalysisEngineFactory.create method). It is just as possible for the description of the component to come directly from an XML descriptor file. So, for example, just because a configuration parameter specifies a default value, this does not mean that the passed in context will have a value for that configuration parameter. It should be possible for a descriptor file to specify its own value or to not provide one at all. If the context does not have a configuration parameter, then the default value provided by the developer as specified by the defaultValue element of the ConfigurationParameter will be used. See comments in the code for additional details.
      Parameters:
      component - the component to initialize.
      context - a UIMA context with configuration parameters.
      Throws:
      org.apache.uima.resource.ResourceInitializationException - if a failure occurs during initialization.
    • initialize

      public static void initialize(Object component, Map<String,Object> map) throws org.apache.uima.resource.ResourceInitializationException
      Initialize a component from a map.
      Parameters:
      component - the component to initialize.
      map - a UIMA context with configuration parameters.
      Throws:
      org.apache.uima.resource.ResourceInitializationException - if a failure occurs during initialization.
      See Also:
    • initialize

      public static void initialize(Object component, org.apache.uima.resource.ResourceSpecifier spec) throws org.apache.uima.resource.ResourceInitializationException
      Initialize a component from a CustomResourceSpecifier.
      Parameters:
      component - the component to initialize.
      spec - a resource specifier.
      Throws:
      org.apache.uima.resource.ResourceInitializationException - if a failure occurs during initialization.
      See Also:
    • initialize

      public static void initialize(Object component, org.apache.uima.resource.Parameter... parameters) throws org.apache.uima.resource.ResourceInitializationException
      Initialize a component from a CustomResourceSpecifier.
      Parameters:
      component - the component to initialize.
      parameters - a list of parameters.
      Throws:
      org.apache.uima.resource.ResourceInitializationException - if a failure occurs during initialization.
      See Also:
    • initialize

      public static void initialize(Object component, org.apache.uima.resource.metadata.NameValuePair... parameters) throws org.apache.uima.resource.ResourceInitializationException
      Initialize a component from a ResourceMetaData.
      Parameters:
      component - the component to initialize.
      parameters - a list of parameters.
      Throws:
      org.apache.uima.resource.ResourceInitializationException - if a failure occurs during initialization.
      See Also:
    • initialize

      public static void initialize(Object component, org.apache.uima.resource.DataResource dataResource) throws org.apache.uima.resource.ResourceInitializationException
      Initialize a component from a ResourceMetaData.
      Parameters:
      component - the component to initialize.
      dataResource - a data resource with configuration meta data.
      Throws:
      org.apache.uima.resource.ResourceInitializationException - if a failure occurs during initialization.
      See Also:
    • initialize

      public static void initialize(Object component, Object... aParameters) throws org.apache.uima.resource.ResourceInitializationException
      Throws:
      org.apache.uima.resource.ResourceInitializationException