liuxiang@MacBookPro: ~/workspace/SpringTest/src/org/shawn/spring $ cat ArroundAdvice.java
package org.shawn.spring;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
public class ArroundAdvice implements MethodInterceptor {
public Object invoke(MethodInvocation invocation) throws Throwable {
Object returnValue;
System.out.println("Before (ArroundAdvice)");
returnValue = invocation.proceed();
System.out.println("After (ArroundAdvice)");
return returnValue;
}
}
liuxiang@MacBookPro: ~/workspace/SpringTest/src/org/shawn/spring $ sed -n '/public Object invoke(MethodInvocation .*)/,$p' ArroundAdvice.java | awk '
{
print;
a=$0;b=$0;
gsub(/[^{]/, "", a);
gsub(/[^}]/, "", b);
x += length(a);
y += length(b);
if(x == y)
exit
}'
public Object invoke(MethodInvocation invocation) throws Throwable {
Object returnValue;
System.out.println("Before (ArroundAdvice)");
returnValue = invocation.proceed();
System.out.println("After (ArroundAdvice)");
return returnValue;
}
liuxiang@MacBookPro: ~/workspace/SpringTest/src/org/shawn/spring $
阅读(1111) | 评论(0) | 转发(0) |