Skip to content

Commit 7472eb5

Browse files
committed
more comments for jdk dynamic proxy
1 parent 5fef1c5 commit 7472eb5

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

src/main/java/us/codecraft/tinyioc/aop/AdvisedSupport.java

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.aopalliance.intercept.MethodInterceptor;
44

55
/**
6+
* 代理相关的元数据
67
78
*/
89
public class AdvisedSupport {

src/main/java/us/codecraft/tinyioc/aop/AopProxy.java

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package us.codecraft.tinyioc.aop;
22

33
/**
4+
* AOP代理
45
56
*/
67
public interface AopProxy {

src/main/java/us/codecraft/tinyioc/aop/JdkDynamicAopProxy.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@
77
import java.lang.reflect.Proxy;
88

99
/**
10+
* 基于jdk的动态代理
11+
*
1012
1113
*/
1214
public class JdkDynamicAopProxy implements AopProxy, InvocationHandler {
1315

1416
private AdvisedSupport advised;
1517

16-
public JdkDynamicAopProxy(AdvisedSupport advised) {
17-
this.advised = advised;
18-
}
18+
public JdkDynamicAopProxy(AdvisedSupport advised) {
19+
this.advised = advised;
20+
}
1921

20-
@Override
22+
@Override
2123
public Object getProxy() {
2224
return Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] { advised.getTargetSource()
2325
.getTargetClass() }, this);
@@ -26,7 +28,8 @@ public Object getProxy() {
2628
@Override
2729
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
2830
MethodInterceptor methodInterceptor = advised.getMethodInterceptor();
29-
return methodInterceptor.invoke(new ReflectiveMethodInvocation(advised.getTargetSource().getTarget(), method, args));
31+
return methodInterceptor.invoke(new ReflectiveMethodInvocation(advised.getTargetSource().getTarget(), method,
32+
args));
3033
}
3134

3235
}

src/main/java/us/codecraft/tinyioc/aop/TargetSource.java

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package us.codecraft.tinyioc.aop;
22

33
/**
4+
* 被代理的对象
45
56
*/
67
public class TargetSource {

0 commit comments

Comments
 (0)