Skip to content

Commit 6ec0599

Browse files
committed
java项目先提交
1 parent 6605293 commit 6ec0599

136 files changed

Lines changed: 3640 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎JavaLib_Zone/.classpath‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="lib" path="lib/asm-2.2.3.jar"/>
4+
<classpathentry kind="lib" path="lib/asm-commons-2.2.3.jar"/>
5+
<classpathentry kind="lib" path="lib/asm-util-2.2.3.jar"/>
6+
<classpathentry kind="lib" path="lib/cglib-nodep-2.1_3.jar"/>
7+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
8+
<classpathentry kind="src" path="src"/>
9+
<classpathentry kind="output" path="bin"/>
10+
</classpath>

‎JavaLib_Zone/.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin

‎JavaLib_Zone/.project‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>JavaLib_Zone</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding/<project>=GBK
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=1.6
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11+
org.eclipse.jdt.core.compiler.source=1.6

‎JavaLib_Zone/lib/asm-2.2.3.jar‎

34 KB
Binary file not shown.
14.8 KB
Binary file not shown.
34.2 KB
Binary file not shown.
317 KB
Binary file not shown.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package Java.Zone.Cglib;
2+
3+
import java.lang.reflect.Method;
4+
5+
import net.sf.cglib.proxy.Enhancer;
6+
import net.sf.cglib.proxy.MethodInterceptor;
7+
import net.sf.cglib.proxy.MethodProxy;
8+
9+
/**
10+
* Aop cglib 动态代理 开始结束方法 可修改
11+
* @author zone
12+
*
13+
*/
14+
public class CglibProxy implements MethodInterceptor {
15+
16+
/**
17+
* 要创建的对象的父类对象;
18+
*/
19+
private Object target;
20+
21+
/**
22+
* 创建代理对象
23+
*
24+
* @param target
25+
* @return
26+
*/
27+
public Object getInstance(Object target) {
28+
this.target = target;
29+
// 设置需要创建子类的类
30+
Enhancer enhancer = new Enhancer();
31+
enhancer.setSuperclass(this.target.getClass());
32+
// 回调方法
33+
enhancer.setCallback(this);
34+
// 创建代理对象 通过字节码技术动态创建子类实例
35+
return enhancer.create();
36+
}
37+
38+
// 拦截父类所有方法的调用 可以对返回的结果进行修改!!!
39+
@Override
40+
public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
41+
/**
42+
* 代码在这里改
43+
*/
44+
Object result = null;
45+
System.out.println("事物开始");
46+
// 通过代理类调用父类中的方法
47+
result = methodProxy.invokeSuper(proxy, args);
48+
System.out.println("事物结束");
49+
//对结果进行了更改 这个屌!!!!
50+
result="2";
51+
return result;
52+
}
53+
54+
}

0 commit comments

Comments
 (0)