?? myproxyfactory.java
字號:
import java.lang.reflect.*;
/**
* Description:
* <br/>Copyright (C), 2008-2010, Yeeku.H.Lee
* <br/>This program is protected by copyright laws.
* <br/>Program Name:
* <br/>Date:
* @author Yeeku.H.Lee kongyeeku@163.com
* @version 1.0
*/
public class MyProxyFactory
{
//為指定target生成動態代理對象
public static Object getProxy(Object target)
throws Exception
{
//創建一個MyInvokationHandler對象
MyInvokationHandler handler =
new MyInvokationHandler();
//為MyInvokationHandler設置target對象
handler.setTarget(target);
//創建、并返回一個動態代理
return Proxy.newProxyInstance(target.getClass().getClassLoader()
, target.getClass().getInterfaces(), handler);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -