01: /*
02: * Copyright 2002-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.aop.aspectj;
18:
19: import java.lang.reflect.Method;
20:
21: import org.aopalliance.intercept.MethodInterceptor;
22: import org.aopalliance.intercept.MethodInvocation;
23:
24: import org.springframework.aop.AfterAdvice;
25:
26: /**
27: * Spring AOP advice wrapping an AspectJ after advice method.
28: *
29: * @author Rod Johnson
30: * @since 2.0
31: */
32: public class AspectJAfterAdvice extends AbstractAspectJAdvice implements
33: MethodInterceptor, AfterAdvice {
34:
35: public AspectJAfterAdvice(Method aspectJBeforeAdviceMethod,
36: AspectJExpressionPointcut pointcut,
37: AspectInstanceFactory aif) {
38:
39: super (aspectJBeforeAdviceMethod, pointcut, aif);
40: }
41:
42: public Object invoke(MethodInvocation mi) throws Throwable {
43: try {
44: return mi.proceed();
45: } finally {
46: invokeAdviceMethod(getJoinPointMatch(), null, null);
47: }
48: }
49:
50: public boolean isBeforeAdvice() {
51: return false;
52: }
53:
54: public boolean isAfterAdvice() {
55: return true;
56: }
57:
58: }
|