public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable { for (int ii = 0; ii < methodsToIntercept.length; ii++) { if (MethodUtil.areMethodsEqual(method, methodsToIntercept[ii])) { return methodsToIntercept[ii].invoke(delegate, args); } } for (int ii = 0; ii < methodsToDuplicate.length; ii++) { if (MethodUtil.areMethodsEqual(method, methodsToDuplicate[ii])) { methodsToDuplicate[ii].invoke(delegate, args); } } return proxy.invokeSuper(obj, args); }
private void findAndAddMethod(Set providedMethods, Method currentMethod, Set actualMethods) { Iterator iterator = providedMethods.iterator(); while (iterator.hasNext()) { Method currentMethodToIntercept = (Method) iterator.next(); if (MethodUtil.areMethodsEqual(currentMethod, currentMethodToIntercept)) { actualMethods.add(currentMethod); iterator.remove(); return; } } }