Java??????????????????????????
???????????? ???????[ 2012/8/13 10:37:46 ] ????????
??????д ServiceCallbackAdapter ??????????????????ζ???????????????е??????????д????????? ServiceCallback ??????У????????????????????????Щ???????? Collections ?? JDBC ????????????????????? IDE ????“Delegate Methods”???????????д??????????????????????????????????????????д??????????????????????????????????????Щ?????????????????????????????????????????“?????????????????????”??
???????????????
?????嵥 2 ?е? SetProxyFactory ????????? Set ?????????????????????????????????????????Set???????????÷??????????????????????????????????κν?????????????????嵥 5 ????????????? SetProxyFactory ???????????????????κν???????????????д???????????????????????????????????????????? T???????? getProxy(T.class??object) ????????????????????????????????
?????嵥 5. ????????????????????
1.public class GenericProxyFactory {
2.public staticT getProxy(Classintf??
3. final T obj) {
4. return (T)
5. Proxy.newProxyInstance(obj.getClass().getClassLoader()??
6. new Class[] { intf }??
7. new InvocationHandler() {
8. public Object invoke(Object proxy?? Method method??
9. Object[] args) throws Throwable {
10. return method.invoke(obj?? args);
11. }
12. });
13. }
14. }
?????????????? Decorator
???????????????????????????????????????????????????????????? ?嵥 2 ?? ?嵥 5 ?м??????????????? Decorator ?????????С???????? Decorator ???У??????????????????簲???????????????????á??嵥 6 ??????????? InvocationHandler??????????????????????????д?????????????????????????????????????????????????????????? invoke() ??????????????????????????????????????? —— ????????????????????????????? GenericProxyFactory ????????????????????? LoggingInvocationHandler ??????????????t????
?????嵥 6. ???????? Decorator????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11