锘??xml version="1.0" encoding="utf-8" standalone="yes"?>在线免费91,欧美高清一级片,国产香蕉视频在线观看http://www.aygfsteel.com/pitey/category/37541.htmlzh-cnWed, 18 Feb 2009 09:55:25 GMTWed, 18 Feb 2009 09:55:25 GMT60- Java闈欐佷唬鐞嗗拰鍔ㄦ佷唬鐞?/title>http://www.aygfsteel.com/pitey/archive/2009/02/18/255279.htmlPiteyPiteyWed, 18 Feb 2009 08:52:00 GMThttp://www.aygfsteel.com/pitey/archive/2009/02/18/255279.htmlhttp://www.aygfsteel.com/pitey/comments/255279.htmlhttp://www.aygfsteel.com/pitey/archive/2009/02/18/255279.html#Feedback0http://www.aygfsteel.com/pitey/comments/commentRss/255279.htmlhttp://www.aygfsteel.com/pitey/services/trackbacks/255279.html
棣栧厛java浠g悊鍒嗕負闈欐佷唬鐞嗗拰鍔ㄦ佷唬鐞嗭紝鍔ㄦ佷唬鐞嗕腑java鎻愪緵鐨勫姩鎬佷唬鐞嗛渶瑕佸姩鎬佷唬鐞嗕竴涓猧nteface,濡傛灉娌℃湁inteface鍒欓渶瑕佷嬌鐢ㄥ疄鐜?span class="Apple-style-span" style="word-spacing: 0px; font: 14px/21px palatino; text-transform: none; color: rgb(0,0,0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0">cglib鎻愪緵鐨勬帴鍙c?br />
涓嬮潰渚嬪瓙鍙疄鐜板姩鎬佷唬鐞?br />

public class MyProxy implements InvocationHandler
{
static Object proxyObj = null;

public static Object getInstance(Object obj)
{
proxyObj= obj;
return Proxy.newProxyInstance(obj.getClass().getClassLoader(), obj.getClass().getInterfaces(), new MyProxy());
}

public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
{
System.out.println("浣跨敤浠g悊..");
return method.invoke(proxyObj, args);
}
}
瀹炵幇鏂瑰紡

public static void main(String[] args)
{
ILeaveService service = (ILeaveService)MyProxy.getInstance(new LeaveServiceImpl());

try
{
service.listBizObjByHql("");
}

catch (ServiceException e)
{
e.printStackTrace();
}
}
鎵撳嵃鍑猴細
浣跨敤浠g悊..
query Hql..
浣跨敤Cglib

public class Test2 implements MethodInterceptor
{

public Object intercept(Object obj, Method method, Object[] args, MethodProxy methodProxy) throws Throwable
{
System.out.println("cglib proxy
");
return methodProxy.invokeSuper(obj, args);
}
}
瀹炵幇

public static void main(String[] args)
{
Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(Test3.class);
enhancer.setCallback(new Test2());
Test3 test = (Test3)enhancer.create();
test.prinInfo("p
.");
}
杈撳嚭
榪囨護鍣?br />

public class Test4 implements CallbackFilter
{


public int accept(Method method)
{

if(method.getName().equals("method1"))
{
return 1;

}else if(method.getName().equals("method2"))
{
return 0;
}
return 0;
}
}
鍙湁榪斿洖0鐨勬墠鎵ц錛?span class="Apple-style-span" style="word-spacing: 0px; font: 14px/21px palatino; text-transform: none; color: rgb(0,0,0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0">cglib涓殑NoOp.INSTANCE灝辨槸涓涓┖鐨勬嫤鎴櫒錛?br />

public static void main(String[] args)
{

Callback [] callbacks = new Callback[]
{new Test2(),NoOp.INSTANCE};
Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(Test3.class);
enhancer.setCallbacks(callbacks);
enhancer.setCallbackFilter(new Test4());
Test3 test3 = (Test3)enhancer.create();
test3.method1();
test3.method2();
}
}
鎵ц緇撴灉
method1
cglib proxy
method2

]]> - [瀵煎叆]涓嬈ava鍨冨溇鏀墮泦璋冧紭瀹炴垬http://www.aygfsteel.com/pitey/archive/2009/02/11/254176.htmlPiteyPiteyWed, 11 Feb 2009 01:17:00 GMThttp://www.aygfsteel.com/pitey/archive/2009/02/11/254176.htmlhttp://www.aygfsteel.com/pitey/comments/254176.htmlhttp://www.aygfsteel.com/pitey/archive/2009/02/11/254176.html#Feedback0http://www.aygfsteel.com/pitey/comments/commentRss/254176.htmlhttp://www.aygfsteel.com/pitey/services/trackbacks/254176.html闃呰鍏ㄦ枃

鏂囩珷鏉ユ簮:http://www.aygfsteel.com/calvin/archive/2008/07/09/213535.html

]]>
主站蜘蛛池模板:
苍溪县|
临海市|
沅江市|
碌曲县|
基隆市|
山西省|
象州县|
军事|
巴彦县|
湘乡市|
且末县|
喀喇沁旗|
威海市|
华容县|
溧水县|
桂林市|
衡南县|
柘城县|
金山区|
宁城县|
阿图什市|
鲁甸县|
河池市|
玉田县|
清水河县|
盐亭县|
东阿县|
根河市|
十堰市|
辽源市|
上栗县|
内江市|
微博|
临泉县|
双峰县|
高尔夫|
榆社县|
宜兴市|
溧阳市|
金坛市|
兴化市|