public Object invokeCaller(MethodByMethodInfo info, Object callingObject, Object target, Object[] args) throws Throwable { MethodCalledByMethodInvocation invocation = new MethodCalledByMethodInvocation(info, callingObject, target, args, info.getInterceptors()); invocation.setTargetObject(target); return invocation.invokeNext(); }
public void addResponseAttachment(Object key, Object val) { wrapped.addResponseAttachment(key, val); }
public Advisor getAdvisor() { return wrapped.getAdvisor(); }
/** * Advice for calls to Class.newInstance() and Constructor.newInstance(). Intended use is for * caller pointcuts. If you wish to handle the intercepted calls, override interceptMethod. * * @param invocation * @return result of invocation * @throws Throwable * @see ReflectionAspect#interceptMethod(Invocation, Object, Method, Object[]) */ public Object interceptMethodInvoke(MethodCalledByMethodInvocation invocation) throws Throwable { Method reflectionMethod = invocation.getCalledMethod(); Object targetObject = invocation.getTargetObject(); Object[] args = invocation.getArguments(); return interceptMethodInvoke(invocation, reflectionMethod, targetObject, args); }
/** * Advice for calls to Class.getDeclaredField(). Cleans fields that get added to the * class by the AOP framework. Intended use is for caller pointcuts. * * @param invocation The invocation * @return java.lang.reflect.Field[] The Field * @throws Throwable * @see Class#getDeclaredField() */ public final Object interceptGetDeclaredField(MethodCalledByMethodInvocation invocation) throws Throwable { Object targetObject = invocation.getTargetObject(); Object[] args = invocation.getArguments(); return interceptGetDeclaredField((Class<?>) targetObject, args); }
return p.matchesCall(mi.getAdvisor(), mi.getCallingMethod(), mi.getCalledMethod().getDeclaringClass(), mi.getCalledMethod());
Method callingMethod = inv.getCallingMethod(); if (isAdvised(callingMethod.getDeclaringClass())) return advisor.invokeCaller(info, inv.getCallingObject(), targetObject, args);
return new MethodCalledByMethodJoinpoint(((MethodCalledByMethodInvocation)invocation).getCallingMethod(), ((MethodCalledByMethodInvocation)invocation).getCalledMethod());
/** * @return the method that is being called */ public Method getCalledMethod() { return wrapped.getCalledMethod(); } }
public MethodCalledByMethodInvocationWrapper(MethodCalledByMethodInvocation wrapped, Interceptor[] interceptors) { super(wrapped.getCallingObject(), interceptors); this.wrapped = wrapped; }
public Class<?> getCallingClass() { return wrapped.getCallingClass(); }
public Method getCallingMethod() { return wrapped.getCallingMethod(); }
public MetaDataResolver getInstanceResolver() { return wrapped.getInstanceResolver(); }
public Object[] getArguments() { return wrapped.getArguments(); }
/** * Copies complete state of Invocation object. * * @return a copy of this instance */ public Invocation copy() { MethodCalledByMethodInvocation wrapper = new MethodCalledByMethodInvocation(advisor, callingClass, callingMethod, method, callingObject, targetObject, arguments, interceptors); wrapper.currentInterceptor = this.currentInterceptor; wrapper.instanceResolver = this.instanceResolver; wrapper.metadata = this.metadata; return wrapper; }
public Invocation copy() { MethodCalledByMethodInvocationWrapper invocation = new MethodCalledByMethodInvocationWrapper((MethodCalledByMethodInvocation) wrapped.copy(), interceptors); invocation.currentInterceptor = this.currentInterceptor; return invocation; }
/** * Advice for calls to Field.setXXX(). Intended use is for caller pointcuts. If you wish to handle * the intercepted calls, override interceptFieldWrite. * * @param invocation * @return result of invocation * @throws Throwable * @see ReflectionAspect#interceptFieldWrite(Invocation, Field, Object, Object) */ public Object interceptFieldSet(MethodCalledByMethodInvocation invocation) throws Throwable { Method reflectionMethod = invocation.getCalledMethod(); Object targetObject = invocation.getTargetObject(); Object[] args = invocation.getArguments(); return interceptFieldSet(invocation, reflectionMethod, targetObject, args); }
/** * Advice for calls to Class.getDeclaredMethod(). Cleans methods that get added to the * class by the AOP framework (Methods introduced by introductions/mixin classes will * still be returned). Intended use is for caller pointcuts. * * @param invocation The invocation * @return java.lang.reflect.Method the declared method * @throws Throwable * @see Class#getDeclaredMethod()() */ public final Object interceptGetDeclaredMethod(MethodCalledByMethodInvocation invocation) throws Throwable { Object targetObject = invocation.getTargetObject(); Object[] args = invocation.getArguments(); return interceptGetDeclaredMethod((Class<?>) targetObject, args); }
Method callingMethod = inv.getCallingMethod(); if (isAdvised(callingMethod.getDeclaringClass())) return advisor.invokeConCalledByMethod(info, inv.getCallingObject(), args);
/** * Advice for calls to Class.newInstance() and Constructor.newInstance(). Intended use is for * caller pointcuts. If you wish to handle the intercepted calls, override interceptConstructor. * * @param invocation * @return result of invocation * @throws Throwable * @see ReflectionAspect#interceptConstructor(Invocation, Constructor, Object[]) */ public Object interceptNewInstance(MethodCalledByMethodInvocation invocation) throws Throwable { Method reflectionMethod = invocation.getCalledMethod(); Object targetObject = invocation.getTargetObject(); Object[] args = invocation.getArguments(); return interceptNewInstance(invocation, reflectionMethod, targetObject, args); }