jodd-proxetta/src/main/java/jodd/proxetta/advice/DelegateAdvice.java
public Object execute() throws Exception {
		String methodName = ProxyTarget.targetMethodName();
		Class[] argTypes = ProxyTarget.createArgumentsClassArray();
		Object[] args = ProxyTarget.createArgumentsArray();

		// lookup method on target object class (and not #targetClass!()
		Class type = _target.getClass();
		Method method = type.getMethod(methodName, argTypes);

		// remember context classloader
		ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();

		Object result;
		try {
			// change class loader
			Thread.currentThread().setContextClassLoader(type.getClassLoader());

			// invoke
			result = method.invoke(_target, args);
		}
		finally {
			// return context classloader
			Thread.currentThread().setContextClassLoader(contextClassLoader);

		}

		return ProxyTarget.returnValue(result);
	}
public Object execute() throws Exception {
		String methodName = ProxyTarget.targetMethodName();
		Class[] argTypes = ProxyTarget.createArgumentsClassArray();
		Object[] args = ProxyTarget.createArgumentsArray();

		// lookup method on target object class (and not #targetClass!()
		Class type = _target.getClass();
		Method method = type.getMethod(methodName, argTypes);

		// remember context classloader
		ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();

		Object result;
		try {
			// change class loader
			Thread.currentThread().setContextClassLoader(type.getClassLoader());

			// invoke
			result = method.invoke(_target, args);
		}
		finally {
			// return context classloader
			Thread.currentThread().setContextClassLoader(contextClassLoader);

		}

		return ProxyTarget.returnValue(result);
	}
public Object execute ( ) throws Exception { String methodName = ProxyTarget . targetMethodName ( ) ; Class [ ] argTypes = ProxyTarget . createArgumentsClassArray ( ) ; Object [ ] args = ProxyTarget . createArgumentsArray ( ) ; // lookup method on target object class (and not #targetClass!() Class type = _target . getClass ( ) ; Method method = type . getMethod ( methodName , argTypes ) ; // remember context classloader ClassLoader contextClassLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; Object result ; try { // change class loader Thread . currentThread ( ) . setContextClassLoader ( type . getClassLoader ( ) ) ; // invoke result = method . invoke ( _target , args ) ; } finally { // return context classloader Thread . currentThread ( ) . setContextClassLoader ( contextClassLoader ) ; } return ProxyTarget . returnValue ( result ) ; }
Looks up for method in target object and invokes it using reflection.
Looks up for method in target object and invokes it using reflection .