Class ConfigurationParameterInitializer
java.lang.Object
org.apache.uima.fit.component.initialize.ConfigurationParameterInitializer
Initialize an instance of a class with fields that are annotated as
ConfigurationParameter
s from the parameter values given in a UimaContext
.-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 aResourceMetaData
.static void
initialize
(Object component, org.apache.uima.resource.metadata.NameValuePair... parameters) Initialize a component from aResourceMetaData
.static void
initialize
(Object component, org.apache.uima.resource.Parameter... parameters) Initialize a component from aCustomResourceSpecifier
.static void
initialize
(Object component, org.apache.uima.resource.ResourceSpecifier spec) Initialize a component from aCustomResourceSpecifier
.static void
initialize
(Object component, org.apache.uima.UimaContext context) Initialize a component from anUimaContext
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 aUimaContext
.
-
Method Details
-
initialize
public static void initialize(Object component, org.apache.uima.UimaContext context) throws org.apache.uima.resource.ResourceInitializationException Initialize a component from anUimaContext
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 aUimaContext
. Here we are performing the latter task. It is important to remember that theUimaContext
passed in to this method may or may not have been derived using reflection of the annotations (i.e. usingConfigurationParameterFactory
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 theConfigurationParameter
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.ResourceInitializationExceptionInitialize 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 aCustomResourceSpecifier
.- 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 aCustomResourceSpecifier
.- 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 aResourceMetaData
.- 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 aResourceMetaData
.- 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
-