nyla.solutions.global.patterns.creational.proxy.ObjectProxy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nyla.solutions.global Show documentation
Show all versions of nyla.solutions.global Show documentation
Nyla Solutions Global Java API provides support for basic application
utilities (application configuration, data encryption, debugger and text
processing).
The newest version!
package nyla.solutions.global.patterns.creational.proxy;
import java.lang.reflect.Method;
import java.util.ArrayList;
import nyla.solutions.global.data.MethodCallFact;
import nyla.solutions.global.exception.RequiredException;
import nyla.solutions.global.exception.SystemException;
import nyla.solutions.global.util.Debugger;
public class ObjectProxy
{
/**
* Execute the method call on a object
* @param object the target object that contains the method
* @param methodCallFact the method call information
* @return the return object of the method call
* @throws Exception
*/
public static Object executeMethod(Object object, MethodCallFact methodCallFact)
throws Exception
{
if (object == null)
throw new RequiredException("object");
if (methodCallFact == null)
throw new RequiredException("methodCallFact");
return executeMethod(object, methodCallFact.getMethodName(),methodCallFact.getArguments());
}// ----------------------------------------------
/**
* Note that this methods does not support auto boxing of primitive types
* @param aObject the object
* @param aMethodName the method
* @param aArguments the input argument
* @return the object return values
* @throws Exception
*/
public static Object executeMethod(Object aObject, String methodName, Object[] aArguments)
throws Exception
{
Class>[] parameterTypes = null;
ArrayList