Class BeanUtils
- java.lang.Object
-
- org.apache.synapse.mediators.bean.BeanUtils
-
public abstract class BeanUtils extends Object
Provides utility methods for method invocation via reflection.
-
-
Constructor Summary
Constructors Constructor Description BeanUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Object
invokeInstanceMethod(Object instance, Method method, Object[] args)
Invokes the given method on the given object via reflection, handles simple type conversion from String to simple types.static Method
resolveMethod(Class clazz, String methodName, int argCount)
Finds a method in the given class with the given method name and argument count.
-
-
-
Method Detail
-
invokeInstanceMethod
public static Object invokeInstanceMethod(Object instance, Method method, Object[] args) throws SynapseException
Invokes the given method on the given object via reflection, handles simple type conversion from String to simple types.- Parameters:
instance
- Instance to invoke the method on.method
- Method to be invoked.args
- Arguments for the method invocation.- Returns:
- Return value of the method invocation.
- Throws:
SynapseException
- If method invocation fails.
-
resolveMethod
public static Method resolveMethod(Class clazz, String methodName, int argCount) throws SynapseException
Finds a method in the given class with the given method name and argument count. Fails to resolve the method if two or more overloaded methods are present with the given name and argument count.- Parameters:
clazz
- Class to search for the method in.methodName
- Method name to search for.argCount
- Length of the argument list.- Returns:
- The resolved method, or null if no matching method is found.
- Throws:
SynapseException
- If two or more overloaded methods are found with the given name and argument count.
-
-