Class JavaInvokeOperations

java.lang.Object
org.mule.extensions.java.internal.operation.JavaInvokeOperations

public class JavaInvokeOperations extends Object
Defines the operations of JavaModule related to invocation of class or instance methods using reflection.
Since:
1.0
  • Constructor Details

    • JavaInvokeOperations

      public JavaInvokeOperations()
  • Method Details

    • invokeStatic

      @Throws(JavaStaticInvokeErrorProvider.class) @OutputResolver(output=StaticMethodTypeResolver.class) @Execution(BLOCKING) public org.mule.runtime.extension.api.runtime.operation.Result<Object,Void> invokeStatic(@ParameterGroup(name="Method") @MetadataKeyId(StaticMethodTypeResolver.class) StaticMethodIdentifier identifier, @Optional @NullSafe @Content @TypeResolver(StaticMethodTypeResolver.class) Map<String,org.mule.runtime.api.metadata.TypedValue<Object>> args, @Optional @Placement(tab="MIME Type") @Summary("The mime type of the payload that this invocation will output") String outputMimeType, @Optional @Placement(tab="MIME Type") @Summary("The encoding of the payload that this invocation will output") String outputEncoding, @DefaultEncoding String defaultEncoding) throws ClassNotFoundModuleException, ArgumentMismatchModuleException, InvocationModuleException, NoSuchMethodModuleException
      Operation that allows the user to invoke static methods with the provided arguments. 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 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)"

      Parameters:
      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 output
      outputEncoding - The encoding of the payload that this invocation will output
      Returns:
      the result of the Method invocation with the given args
      Throws:
      ClassNotFoundModuleException - if the given class is not found in the current context
      NoSuchMethodModuleException - if the given class does not declare a method with the given signature
      ArgumentMismatchModuleException - if the method requires a different set of arguments than the ones provided
      InvocationModuleException - if an error occurs during the execution of the method
    • invoke

      @Throws(JavaInvokeErrorProvider.class) @OutputResolver(output=InstanceMethodTypeResolver.class) @Execution(BLOCKING) public org.mule.runtime.extension.api.runtime.operation.Result<Object,Void> invoke(@ParameterGroup(name="Method") @MetadataKeyId(InstanceMethodTypeResolver.class) MethodIdentifier identifier, Object instance, @Optional @NullSafe @Content @TypeResolver(InstanceMethodTypeResolver.class) Map<String,org.mule.runtime.api.metadata.TypedValue<Object>> args, @Optional @Placement(tab="MIME Type") @Summary("The mime type of the payload that this invocation will output") String outputMimeType, @Optional @Placement(tab="MIME Type") @Summary("The encoding of the payload that this invocation will output") String outputEncoding, @DefaultEncoding String defaultEncoding) throws ClassNotFoundModuleException, WrongTypeModuleException, ArgumentMismatchModuleException, InvocationModuleException, NoSuchMethodModuleException
      Operation that allows the user to invoke methods with the provided 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)"

      Parameters:
      identifier - the unique identifier for the method to be invoked
      instance - the instance on which the method will 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 output
      outputEncoding - The encoding of the payload that this invocation will output
      Returns:
      the result of the Method invocation with the given args
      Throws:
      ClassNotFoundModuleException - if the given class is not found in the current context
      NoSuchMethodModuleException - if the given class does not declare a method with the given signature
      ArgumentMismatchModuleException - if the method requires a different set of arguments than the ones provided
      WrongTypeModuleException - if the given instance is not an instance of the expected class
      InvocationModuleException - if an error occurs during the execution of the method