public Object invokeConstructorCaller(MethodByConInfo info, Object callingObject, Object target, Object[] args) throws Throwable { MethodCalledByConstructorInvocation invocation = new MethodCalledByConstructorInvocation(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 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(MethodCalledByConstructorInvocation 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.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(MethodCalledByConstructorInvocation invocation) throws Throwable { Object targetObject = invocation.getTargetObject(); Object[] args = invocation.getArguments(); return interceptGetDeclaredField((Class<?>) targetObject, args); }
return p.matchesCall(mi.getAdvisor(), mi.getCalling(), mi.getCalledMethod().getDeclaringClass(), mi.getCalledMethod());
Constructor<?> callingCon = inv.getCalling(); Class<?> callingClass = callingCon.getDeclaringClass(); if (isAdvised(callingClass)) return advisor.invokeConstructorCaller(info, inv.getCallingObject(), targetObject, args);
return new MethodCalledByConstructorJoinpoint(((MethodCalledByConstructorInvocation)invocation).getCalling(), ((MethodCalledByConstructorInvocation)invocation).getCalledMethod());
public MethodCalledByConstructorInvocationWrapper(MethodCalledByConstructorInvocation wrapped, Interceptor[] interceptors) { super(wrapped.getCallingObject(), interceptors); this.wrapped = wrapped; }
public Method getCalledMethod() { return wrapped.getCalledMethod(); }
public Object[] getArguments() { return wrapped.getArguments(); }
public Object getMetaData(Object group, Object attr) { return wrapped.getMetaData(group, attr); }
public MetaDataResolver getInstanceResolver() { return wrapped.getInstanceResolver(); }
public Constructor<?> getCalling() { return wrapped.getCalling(); }
/** * Copies complete state of Invocation object. * * @return a copy of this instance */ public Invocation copy() { MethodCalledByConstructorInvocation wrapper = new MethodCalledByConstructorInvocation( advisor, calling, method, callingObject, targetObject, arguments, interceptors); wrapper.currentInterceptor = this.currentInterceptor; wrapper.metadata = this.metadata; wrapper.instanceResolver = this.instanceResolver; return wrapper; }
public Invocation copy() { MethodCalledByConstructorInvocationWrapper invocation = new MethodCalledByConstructorInvocationWrapper((MethodCalledByConstructorInvocation)wrapped.copy(), interceptors); invocation.currentInterceptor = this.currentInterceptor; return invocation; } }
/** * Advice for calls to Field.getXXX(). Intended use is for caller pointcuts. If you wish to handle * the intercepted calls, override interceptFieldRead. * * @param invocation * @return The value of the field (or whatever you choose) * @throws Throwable * @see ReflectionAspect#interceptFieldRead(Invocation, Field, Object) */ public Object interceptFieldGet(MethodCalledByConstructorInvocation invocation) throws Throwable { Method reflectionMethod = invocation.getCalledMethod(); Object targetObject = invocation.getTargetObject(); Object[] args = invocation.getArguments(); return interceptFieldGet(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(MethodCalledByConstructorInvocation invocation) throws Throwable { Object targetObject = invocation.getTargetObject(); Object[] args = invocation.getArguments(); return interceptGetDeclaredMethod((Class<?>) targetObject, args); }
Constructor<?> callingCon = inv.getCalling(); Class<?> callingClass = callingCon.getDeclaringClass(); if (isAdvised(callingClass)) return advisor.invokeConCalledByCon(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(MethodCalledByConstructorInvocation invocation) throws Throwable { Method reflectionMethod = invocation.getCalledMethod(); Object targetObject = invocation.getTargetObject(); Object[] args = invocation.getArguments(); return interceptNewInstance(invocation, reflectionMethod, targetObject, args); }