Class JavaModuleFunctions

java.lang.Object
org.mule.extensions.java.internal.function.JavaModuleFunctions

public class JavaModuleFunctions extends Object
The ExpressionFunctions exposed by the JavaModule that extends the EL with further Java related functions.
Since:
1.0
  • Constructor Details

    • JavaModuleFunctions

      public JavaModuleFunctions()
  • Method Details

    • invoke

      public Object invoke(@Alias("class") @Summary("Fully qualified name of the Class containing the referenced Method") String clazz, @Alias("method") @Summary("Represents the Method signature containing the method name and it\'s argument types.") String methodName, Object instance, @Optional Map<String,org.mule.runtime.api.metadata.TypedValue<Object>> args) throws NoSuchMethodModuleException, ClassNotFoundModuleException, WrongTypeModuleException, ArgumentMismatchModuleException, InvocationModuleException
      Function 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:
      clazz - the fully qualified name of the class whose instance is being injected
      methodName - 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
      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
    • isInstanceOf

      public boolean isInstanceOf(Object instance, @Alias("class") @Summary("Fully qualified name of the Class you want to check against") String clazz) throws ClassNotFoundModuleException
      Function that allows the user to check that a given instance is an instanceof the specified class.
      Parameters:
      clazz - the fully qualified name of the expected Class for the instance
      instance - the object whose type is expected to be an instanceof of the given class
      Throws:
      ClassNotFoundModuleException - if the given class is not found in the current context
    • getRootCause

      public Throwable getRootCause(Throwable exception)
      Function that provides a way to obtain the root cause of a given Throwable.
      Parameters:
      exception - the Throwable whose root cause is wanted
      Returns:
      the root cause of the given exception, or null if no cause is found.
    • isCausedBy

      public boolean isCausedBy(Throwable exception, @Summary("Fully qualified name of the Class you want to check against") String throwableType, @Optional boolean includeSubtypes)
      This Function returns true if the given Throwable that matches the specified class in the exception cause chain. If acceptSubtypes is true, subclasses of the specified class will also match.
      Parameters:
      exception - the Throwable to inspect
      throwableType - fully qualified name of the Class you want to check against
      includeSubtypes - if true, subclasses of the specified class will also result in a match
      Returns:
      the index into the throwable chain, false if no match or null input