1 16 17 package org.springframework.aop.framework.adapter; 18 19 import java.io.Serializable ; 20 21 import org.aopalliance.intercept.MethodInterceptor; 22 import org.aopalliance.intercept.MethodInvocation; 23 24 import org.springframework.aop.AfterAdvice; 25 import org.springframework.aop.AfterReturningAdvice; 26 import org.springframework.util.Assert; 27 28 35 public class AfterReturningAdviceInterceptor implements MethodInterceptor, AfterAdvice, Serializable { 36 37 private final AfterReturningAdvice advice; 38 39 40 44 public AfterReturningAdviceInterceptor(AfterReturningAdvice advice) { 45 Assert.notNull(advice, "Advice must not be null"); 46 this.advice = advice; 47 } 48 49 public Object invoke(MethodInvocation mi) throws Throwable { 50 Object retVal = mi.proceed(); 51 this.advice.afterReturning(retVal, mi.getMethod(), mi.getArguments(), mi.getThis()); 52 return retVal; 53 } 54 55 } 56 | Popular Tags |