Chinaunix首页 | 论坛 | 博客
  • 博客访问: 29603
  • 博文数量: 6
  • 博客积分: 1728
  • 博客等级: 大尉
  • 技术积分: 70
  • 用 户 组: 普通用户
  • 注册时间: 2009-06-06 20:12
文章分类
文章存档

2010年(1)

2009年(5)

最近访客

分类:

2009-06-07 13:49:42


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) |
0

上一篇:发日志能赚分吗

下一篇:关于mp3的TAG

给主人留下些什么吧!~~