JDK動態代理

Class Proxy implements InvocationHandler{
Object tar =null;
public Object bid(Object tar){
this.tar=tar;
return Proxy.newProxyInstance(tar.getClass().getClassLoader(),tar.getClass.getInterfaces,this);
}
//重寫Invoke 方法
public Object invoke(Object proxy,Method method,Object[] args) throws throwable{
Object result=null;
result=method.invoke(tar,args);
return result;
}

}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章