Interface PipelineRegistrar
- All Known Implementing Classes:
PipelineRegistrarImpl
public interface PipelineRegistrar
Allows a Transformer Module to register methods for availability in pipelines.
Notes:- The API currently does not support methods with return types other than void
- When overloaded methods are registered with pipelines, the following rules are applied when calling from a pipeline back into Java:
- check whether the number of arguments matches any available signature
- check whether the arguments passed to the pipeline function can be converted to the types on the signature
- If more than one valid signature is found, then no calls into Java are made
public class MyPipelineCallbacks {
public void myMethod(int a) {
System.out.println("called from pipeline with < " + a + ">");
}
public void myMethod(int a, int b) {
System.out.println("called from pipeline with < " + a + "> <" + b + ">");
}
}
//initialise method of Transformer module
public void initialise(java.lang.String moduleName, TransformerAccessor transformerAccessor) {
MyPipelineCallbacks callbackObject = new MyPipelineCallbacks();
transformerAccessor.getPipelineRegistrar().registerPipelineMethod(callbackObject, "myMethod");
}
-
Method Summary
Modifier and TypeMethodDescriptionvoid
registerPipelineMethod
(Object object, String methodName) Registers a function with the name pipelineFunctionName with the Pipeline module so that pipelines can call into Java Transformer modules.void
registerPipelineMethod
(Object object, String pipelineFunctionName, String methodName) Registers a function with the name pipelineFunctionName with the Pipeline module so that pipelines can call into Java Transformer modules.
-
Method Details
-
registerPipelineMethod
Registers a function with the name pipelineFunctionName with the Pipeline module so that pipelines can call into Java Transformer modules. The registrar looks up all methods with methodName on the class of object and checks their signatures against valid types defined inPipelineType
. All methods passing this validity check will get registered with pipelines. In case of methods being overloaded, the correct one to call will be determined at runtime, with a few limitations - see Notes.- Parameters:
object
- object where the method will get called onmethodName
- method to be called on the provided object- Throws:
NoSuchMethodException
- if no method with the given name can be found
-
registerPipelineMethod
void registerPipelineMethod(Object object, String pipelineFunctionName, String methodName) throws NoSuchMethodException Registers a function with the name pipelineFunctionName with the Pipeline module so that pipelines can call into Java Transformer modules. The registrar looks up all methods with methodName on the class of object and checks their signatures against valid types defined inPipelineType
. All methods passing this validity check will get registered with pipelines. In case of methods being overloaded, the correct one to call will be determined at runtime, with a few limitations - see Notes.- Parameters:
object
- object where the method will get called onpipelineFunctionName
- function name registered with pipelinesmethodName
- method to be called on the provided object- Throws:
NoSuchMethodException
- if no method with the given name can be found
-