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 |
|---|---|
org.mule.runtime.extension.api.runtime.operation.Result<Object,Void> |
invoke(MethodIdentifier identifier,
Object instance,
Map<String,org.mule.runtime.api.metadata.TypedValue<Object>> args,
String outputMimeType,
String outputEncoding,
String defaultEncoding)
Operation that allows the user to invoke methods with the provided
args on the given instance. |
org.mule.runtime.extension.api.runtime.operation.Result<Object,Void> |
invokeStatic(StaticMethodIdentifier identifier,
Map<String,org.mule.runtime.api.metadata.TypedValue<Object>> args,
String outputMimeType,
String outputEncoding,
String defaultEncoding)
Operation that allows the user to invoke static methods with the provided arguments.
|
@Throws(value=JavaStaticInvokeErrorProvider.class) @OutputResolver(output=StaticMethodTypeResolver.class) public org.mule.runtime.extension.api.runtime.operation.Result<Object,Void> 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, @Optional @Placement(tab="MIME Type") @Summary(value="The mime type of the payload that this invocation will output") String outputMimeType, @Optional @Placement(tab="MIME Type") @Summary(value="The encoding of the payload that this invocation will output") String outputEncoding, @DefaultEncoding String defaultEncoding) 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.outputMimeType - The mime type of the payload that this invocation will outputoutputEncoding - The encoding of the payload that this invocation will outputMethod 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) public org.mule.runtime.extension.api.runtime.operation.Result<Object,Void> 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, @Optional @Placement(tab="MIME Type") @Summary(value="The mime type of the payload that this invocation will output") String outputMimeType, @Optional @Placement(tab="MIME Type") @Summary(value="The encoding of the payload that this invocation will output") String outputEncoding, @DefaultEncoding String defaultEncoding) 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.outputMimeType - The mime type of the payload that this invocation will outputoutputEncoding - The encoding of the payload that this invocation will outputMethod 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 © 2018 MuleSoft, Inc.. All rights reserved.