Class JavaModuleFunctions
java.lang.Object
org.mule.extensions.java.internal.function.JavaModuleFunctions
The
ExpressionFunctions exposed by the JavaModule that extends the EL with further Java related functions.- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetRootCause(Throwable exception) Function that provides a way to obtain the root cause of a givenThrowable.invoke(String clazz, String methodName, Object instance, Map<String, org.mule.runtime.api.metadata.TypedValue<Object>> args) Function that allows the user to invoke methods with the providedargson the giveninstance.booleanisCausedBy(Throwable exception, String throwableType, boolean includeSubtypes) This Function returnstrueif the givenThrowablethat matches the specified class in the exception cause chain.booleanisInstanceOf(Object instance, String clazz) Function that allows the user to check that a giveninstanceis aninstanceofthe specifiedclass.
-
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, InvocationModuleExceptionFunction that allows the user to invoke methods with the providedargson the giveninstance. The identifier of theMethodto be invoked includes theclassandmethodnames, being themethoda full description of its signature including the types of each parameter.For example, if we want to invoke the method
echowith signaturepublic String echo(String msg)which belongs toClassorg.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 injectedmethodName- the unique identifier for the method to be invokedinstance- the instance on which themethodwill be invokedargs- the arguments used to invoke the givenMethod- Returns:
- the result of the
Methodinvocation with the givenargs - Throws:
ClassNotFoundModuleException- if the givenclassis not found in the current contextNoSuchMethodModuleException- if the givenclassdoes not declare a method with the given signatureArgumentMismatchModuleException- if themethodrequires a different set of arguments than the ones providedWrongTypeModuleException- if the giveninstanceis not an instance of the expectedclassInvocationModuleException- 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 giveninstanceis aninstanceofthe specifiedclass.- Parameters:
clazz- the fully qualified name of the expectedClassfor the instanceinstance- the object whose type is expected to be aninstanceofof the givenclass- Throws:
ClassNotFoundModuleException- if the givenclassis not found in the current context
-
getRootCause
Function that provides a way to obtain the root cause of a givenThrowable. -
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 returnstrueif the givenThrowablethat matches the specified class in the exception cause chain. IfacceptSubtypesistrue, subclasses of the specified class will also match.- Parameters:
exception- theThrowableto inspectthrowableType- fully qualified name of the Class you want to check againstincludeSubtypes- 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
-