Skip to content

Commit c0b3d5d

Browse files
committed
上传文件
1 parent ac080f0 commit c0b3d5d

File tree

7 files changed

+65
-1
lines changed

7 files changed

+65
-1
lines changed
1.1 MB
Loading
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package base.agent.fastclass;
2+
3+
/**
4+
* @author zhangluping on 2018/8/21.
5+
*/
6+
public class FastIndex {
7+
public Object invoke(int index, Object o, Object[] ol) {
8+
FastOrigin t = (FastOrigin) o;
9+
switch (index) {
10+
case 1:
11+
t.first();
12+
return null;
13+
case 2:
14+
t.second();
15+
return null;
16+
}
17+
return null;
18+
}
19+
20+
public int getIndex(String signature) {
21+
switch (signature.hashCode()) {
22+
case -849024079:
23+
return 1;
24+
case 943455349:
25+
return 2;
26+
}
27+
return -1;
28+
}
29+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package base.agent.fastclass;
2+
3+
/**
4+
* @author zhangluping on 2018/8/21.
5+
*/
6+
public class FastOrigin {
7+
8+
public void first() {
9+
System.out.println("first method");
10+
}
11+
12+
public void second() {
13+
System.out.println("second method");
14+
}
15+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package base.agent.fastclass;
2+
3+
import org.junit.Test;
4+
5+
/**
6+
* @author zhangluping on 2018/8/21.
7+
*/
8+
public class TestFastIndexClass {
9+
10+
/**
11+
* 测试fastclass的方法执行
12+
*/
13+
@Test
14+
public void testFastIndex() {
15+
FastOrigin tt = new FastOrigin();
16+
FastIndex fc = new FastIndex();
17+
int index = fc.getIndex("first()");
18+
fc.invoke(index, tt, null);
19+
}
20+
}
Binary file not shown.

java-knowledge-base/src/test/java/base/agent/TestProxyFactory.java renamed to java-knowledge-base/src/main/java/base/agent/proxy/test/TestProxyFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package base.agent;
1+
package base.agent.proxy.test;
22

33
import base.agent.proxy.cglib.CGlibProxyFactory;
44
import base.agent.proxy.jdk.JDKProxyFactory;

0 commit comments

Comments
 (0)