1 8 package test.constructor; 9 10 import org.codehaus.aspectwerkz.definition.Pointcut; 11 import org.codehaus.aspectwerkz.definition.Pointcut; 12 import org.codehaus.aspectwerkz.joinpoint.ConstructorSignature; 13 import org.codehaus.aspectwerkz.joinpoint.JoinPoint; 14 15 19 public class ConstructorTestAspect { 20 22 26 Pointcut call1; 27 28 31 Pointcut call2; 32 33 36 Pointcut call3; 37 38 42 Pointcut call4; 43 44 48 Pointcut call5; 49 50 53 Pointcut execution1; 54 55 58 Pointcut execution2; 59 60 63 Pointcut execution3; 64 65 68 Pointcut execution4; 69 70 73 Pointcut execution5; 74 75 77 80 public Object aroundCall(final JoinPoint joinPoint) throws Throwable { 81 ConstructorAdviceTest.logCall("beforeCall "); 82 final Object result = joinPoint.proceed(); 83 ConstructorAdviceTest.logCall("afterCall "); 84 return result; 85 } 86 87 90 public void beforeCall(final JoinPoint joinPoint) throws Throwable { 91 ConstructorAdviceTest.logCall("preCall "); 92 } 93 94 97 public void afterCall(final JoinPoint joinPoint) throws Throwable { 98 ConstructorAdviceTest.logCall("postCall "); 99 ConstructorSignature sig = (ConstructorSignature) joinPoint.getSignature(); 100 } 101 102 105 public Object aroundCall2(final JoinPoint joinPoint) throws Throwable { 106 return new Integer (0); 107 } 108 109 112 public Object aroundExecution(final JoinPoint joinPoint) throws Throwable { 113 ConstructorAdviceTest.logExecution("beforeExecution "); 114 final Object result = joinPoint.proceed(); 115 ConstructorAdviceTest.logExecution("afterExecution "); 116 return result; 117 } 118 119 122 public void beforeExecution(final JoinPoint joinPoint) throws Throwable { 123 ConstructorAdviceTest.logExecution("preExecution "); 124 } 125 126 129 public void afterExecution(final JoinPoint joinPoint) throws Throwable { 130 ConstructorAdviceTest.logExecution("postExecution "); 131 } 132 133 136 public Object aroundExecution2(final JoinPoint joinPoint) throws Throwable { 137 ((TestReturnFalseType) joinPoint.getTarget()).m_updatedByAdvice = true; 139 return new Integer (0); } 141 } | Popular Tags |