org.apache.uima.fit.component.initialize

## 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 `ConfigurationParameter`s from the parameter values given in a `UimaContext`.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `initialize(Object component, DataResource dataResource)` Initialize a component from a `ResourceMetaData`.
    `static void` | `initialize(Object component, Map<String,Object> map)` Initialize a component from a map.
    `static void` | `initialize(Object component, NameValuePair... parameters)` Initialize a component from a `ResourceMetaData`.
    `static void` | `initialize(Object component, Object... aParameters)`
    `static void` | `initialize(Object component, Parameter... parameters)` Initialize a component from a `CustomResourceSpecifier`.
    `static void` | `initialize(Object component, ResourceSpecifier spec)` Initialize a component from a `CustomResourceSpecifier`.
    `static void` | `initialize(Object component, 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 Detail

    - #### initialize

          public static void initialize(Object component,
                                        UimaContext context)
                                 throws 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:
        `ResourceInitializationException` - if a failure occurs during initialization.

    - #### initialize

          public static void initialize(Object component,
                                        Map<String,Object> map)
                                 throws ResourceInitializationException

      Initialize a component from a map.
      Parameters:
        `component` - the component to initialize.
        `map` - a UIMA context with configuration parameters.
      Throws:
        `ResourceInitializationException` - if a failure occurs during initialization.
      See Also:
        `initialize(Object, UimaContext)`

    - #### initialize

          public static void initialize(Object component,
                                        ResourceSpecifier spec)
                                 throws ResourceInitializationException

      Initialize a component from a `CustomResourceSpecifier`.
      Parameters:
        `component` - the component to initialize.
        `spec` - a resource specifier.
      Throws:
        `ResourceInitializationException` - if a failure occurs during initialization.
      See Also:
        `initialize(Object, UimaContext)`

    - #### initialize

          public static void initialize(Object component,
                                        Parameter... parameters)
                                 throws ResourceInitializationException

      Initialize a component from a `CustomResourceSpecifier`.
      Parameters:
        `component` - the component to initialize.
        `parameters` - a list of parameters.
      Throws:
        `ResourceInitializationException` - if a failure occurs during initialization.
      See Also:
        `initialize(Object, UimaContext)`

    - #### initialize

          public static void initialize(Object component,
                                        NameValuePair... parameters)
                                 throws ResourceInitializationException

      Initialize a component from a `ResourceMetaData`.
      Parameters:
        `component` - the component to initialize.
        `parameters` - a list of parameters.
      Throws:
        `ResourceInitializationException` - if a failure occurs during initialization.
      See Also:
        `initialize(Object, UimaContext)`

    - #### initialize

          public static void initialize(Object component,
                                        DataResource dataResource)
                                 throws ResourceInitializationException

      Initialize a component from a `ResourceMetaData`.
      Parameters:
        `component` - the component to initialize.
        `dataResource` - a data resource with configuration meta data.
      Throws:
        `ResourceInitializationException` - if a failure occurs during initialization.
      See Also:
        `initialize(Object, UimaContext)`

    - #### initialize

          public static void initialize(Object component,
                                        Object... aParameters)
                                 throws ResourceInitializationException

      Throws:
        `ResourceInitializationException`

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