Class ServicePreprocessor

  • All Implemented Interfaces:
    Cancelable, Contextual, ModulePreprocessor, ModuleProcessor, PreprocessorPlugin, SciJavaPlugin

    public class ServicePreprocessor
    extends AbstractPreprocessorPlugin
    The service preprocessor automatically populates module inputs that implement Service.

    Services are obtained from this preprocessor instance's application context.

    Many modules (e.g., most Commands) use @Parameter-annotated service fields, resulting in those parameters being populated when the SciJava application context is injected (via Context.inject(Object)). However, some modules may have service parameters which are programmatically generated (i.e., returned directly as inputs from ModuleInfo.inputs() and as such not populated by context injection. E.g., this situation is the case for scripts, since module inputs are parsed from the script header rather than declared via the @Parameter annotation. In such cases, we need this service preprocessor to fill in the service values.

    Author:
    Curtis Rueden
    • Constructor Detail

      • ServicePreprocessor

        public ServicePreprocessor()
    • Method Detail

      • process

        public void process​(Module module)
        Description copied from interface: ModuleProcessor
        Performs a processing step on the given module instance.