/** * Attempt to invoke the original interceptor chain attached to the * field read in the target class. * For now we don't bother attempting to use optimized invocations since we * are using reflection anyway */ private Object invokeOriginalChainIfExists(Invocation invocation, Field field, Object targetObject) throws Throwable { //Don't attach to caller chain, since we don't have caller interception for fields //Try to attach to chain on target object ClassAdvisor advisor = AspectManager.instance().getAdvisor(field.getDeclaringClass()); Class<?> calledClass = field.getDeclaringClass(); if (isAdvised(calledClass)) { if (advisor != null && advisor.hasAspects()) { int index = advisor.getFieldIndex(field); if (index >= 0) { FieldInfo jp = advisor.getFieldReadInfos()[index]; return jp.getWrapper().invoke(null, new Object[] {targetObject}); } } } return invocation.invokeNext(); }
/** * Attempt to invoke the original interceptor chain attached to the * field write in the target class. * For now we don't bother attempting to use optimized invocations since we * are using reflection anyway */ private Object invokeOriginalChainIfExists(Invocation invocation, Field field, Object targetObject, Object value) throws Throwable { //Don't attach to caller chain, since we don't have caller interception for fields //Try to attach to chain on target object ClassAdvisor advisor = AspectManager.instance().getAdvisor(field.getDeclaringClass()); Class<?> calledClass = field.getDeclaringClass(); if (isAdvised(calledClass)) { if (advisor != null && advisor.hasAspects()) { int index = advisor.getFieldIndex(field); if (index >= 0) { FieldInfo jp = advisor.getFieldWriteInfos()[index]; return jp.getWrapper().invoke(null, new Object[] {targetObject, value}); } } } return invocation.invokeNext(); }