public class JavaInvokeOperations extends Object
JavaModule related to invocation of class or instance methods using reflection.| Constructor and Description |
|---|
JavaInvokeOperations() |
| Modifier and Type | Method and Description |
|---|---|
Object |
invoke(MethodIdentifier identifier,
Object instance,
Map<String,org.mule.runtime.api.metadata.TypedValue<Object>> args)
Operation that allows the user to invoke methods with the provided
args on the given instance. |
Object |
invokeStatic(StaticMethodIdentifier identifier,
Map<String,org.mule.runtime.api.metadata.TypedValue<Object>> args)
Operation that allows the user to invoke static methods with the provided arguments.
|
@Throws(value=JavaStaticInvokeErrorProvider.class) @OutputResolver(output=StaticMethodTypeResolver.class) @Execution(value=BLOCKING) public Object invokeStatic(@ParameterGroup(name="Method") @MetadataKeyId(value=StaticMethodTypeResolver.class) StaticMethodIdentifier identifier, @Optional @NullSafe @Content @TypeResolver(value=StaticMethodTypeResolver.class) Map<String,org.mule.runtime.api.metadata.TypedValue<Object>> args) throws ClassNotFoundModuleException, ArgumentMismatchModuleException, InvocationModuleException, NoSuchMethodModuleException
Method to be invoked includes the class and method names,
being the method a full description of its signature including the types of each parameter.
For example, if we want to invoke the static method echo with signature public static String echo(String msg)
which belongs to Class org.bar.Foo, then the identifier of the method will be "echo(String)"
identifier - the unique identifier for the method to be invoked.args - the arguments used to invoke the given Method. This parameter must be a map with the names
of the method arguments as keys, and each of the argument values as values.
For example, given a method echo with signature public String echo(String msg, String volume) a
possible value for args is:
#[{
msg : 'This is a message to echo',
volume : 'Loud'
}]
In order to use those argument names the java class must be compiled with -parameters, in other case
you have to use the canonical names for the arguments:
#[{
arg0 : 'This is a message to echo',
arg1 : 'Loud'
}]
You can always use the canonical name for the arguments, even if the source code was compiled with
-parameters.Method invocation with the given argsClassNotFoundModuleException - if the given class is not found in the current contextNoSuchMethodModuleException - if the given class does not declare a method with the given signatureArgumentMismatchModuleException - if the method requires a different set of arguments than the ones providedInvocationModuleException - if an error occurs during the execution of the method@Throws(value=JavaInvokeErrorProvider.class) @OutputResolver(output=InstanceMethodTypeResolver.class) @Execution(value=BLOCKING) public Object invoke(@ParameterGroup(name="Method") @MetadataKeyId(value=InstanceMethodTypeResolver.class) MethodIdentifier identifier, Object instance, @Optional @NullSafe @Content @TypeResolver(value=InstanceMethodTypeResolver.class) Map<String,org.mule.runtime.api.metadata.TypedValue<Object>> args) throws ClassNotFoundModuleException, WrongTypeModuleException, ArgumentMismatchModuleException, InvocationModuleException, NoSuchMethodModuleException
args on the given instance.
The identifier of the Method to be invoked includes the class and method names,
being the method a full description of its signature including the types of each parameter.
For example, if we want to invoke the method echo with signature public String echo(String msg)
which belongs to Class org.bar.Foo, then the identifier of the method will be "echo(String)"
identifier - the unique identifier for the method to be invokedinstance - the instance on which the method will be invokedargs - the arguments used to invoke the given Method. This parameter must be a map with the names
of the method arguments as keys, and each of the argument values as values.
For example, given a method echo with signature public String echo(String msg, String volume) a
possible value for args is:
#[{
msg : 'This is a message to echo',
volume : 'Loud'
}]
In order to use those argument names the java class must be compiled with -parameters, in other case
you have to use the canonical names for the arguments:
#[{
arg0 : 'This is a message to echo',
arg1 : 'Loud'
}]
You can always use the canonical name for the arguments, even if the source code was compiled with
-parameters.Method invocation with the given argsClassNotFoundModuleException - if the given class is not found in the current contextNoSuchMethodModuleException - if the given class does not declare a method with the given signatureArgumentMismatchModuleException - if the method requires a different set of arguments than the ones providedWrongTypeModuleException - if the given instance is not an instance of the expected classInvocationModuleException - if an error occurs during the execution of the methodCopyright © 2019 MuleSoft, Inc.. All rights reserved.