Skip to content

Commit bfb938f

Browse files
committed
aop joinpoint
1 parent 78e84e6 commit bfb938f

7 files changed

Lines changed: 78 additions & 1 deletion

File tree

changelog.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,10 @@ helloWorldService.helloWorld();
146146

147147
是不是非常熟悉?至此为止,我们的tiny-spring的IoC部分可说完工了。这部分的类、方法命名和作用,都是对应Spring中相应的组件。虽然代码量只有400多行,但是已经有了基本的IoC功能!
148148

149-
# AOP
149+
# 第二部分:AOP及实现
150+
151+
## 7.step7-使用JDK动态代理实现AOP织入
152+
git checkout step-7-method-interceptor-by-jdk-dynamic-proxy
153+
154+
155+
## 8.step8-使用Aspectj管理切面
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package us.codecraft.tinyioc.aop;
2+
3+
import org.aopalliance.aop.Advice;
4+
5+
/**
6+
* @author yihua.huang@dianping.com
7+
*/
8+
public interface Advisor {
9+
10+
Advice getAdvice();
11+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package us.codecraft.tinyioc.aop;
2+
3+
import org.aopalliance.aop.Advice;
4+
5+
/**
6+
* @author yihua.huang@dianping.com
7+
*/
8+
public class AspectJExpressionPointcutAdvisor implements PointcutAdvisor{
9+
10+
@Override
11+
public Advice getAdvice() {
12+
return null;
13+
}
14+
15+
@Override
16+
public Pointcut getPointcut() {
17+
return null;
18+
}
19+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package us.codecraft.tinyioc.aop;
2+
3+
/**
4+
* @author yihua.huang@dianping.com
5+
*/
6+
public interface ClassFilter {
7+
8+
boolean matches(Class clazz);
9+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package us.codecraft.tinyioc.aop;
2+
3+
import java.lang.reflect.Method;
4+
5+
/**
6+
* @author yihua.huang@dianping.com
7+
*/
8+
public interface MethodMatcher {
9+
10+
boolean matches(Method method, Class targetClass);
11+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package us.codecraft.tinyioc.aop;
2+
3+
/**
4+
* @author yihua.huang@dianping.com
5+
*/
6+
public interface Pointcut {
7+
8+
ClassFilter getClassFilter();
9+
10+
MethodMatcher getMethodMatcher();
11+
12+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package us.codecraft.tinyioc.aop;
2+
3+
/**
4+
* @author yihua.huang@dianping.com
5+
*/
6+
public interface PointcutAdvisor extends Advisor{
7+
8+
Pointcut getPointcut();
9+
}

0 commit comments

Comments
 (0)