posts - 262,  comments - 221,  trackbacks - 0
          在impl.basic包下,還有一個(gè)和Channel類息息相關(guān)的類:ChannelBuilder類,它負(fù)責(zé)直接構(gòu)建Channel對象。其責(zé)職就是工廠模式中的工廠。

          在ChannelBuilder下有幾種類型的方法:
           ★構(gòu)造方法和初始化方法:即創(chuàng)建Channel對象的方法及初始化的方法
           ★元素構(gòu)建方法:即構(gòu)建Channel子元素的方法
           ★事務(wù)控制方法:即控制構(gòu)建,析構(gòu)過程的方法

          下面說一下第一類方法,Informa的ChannelBuilder構(gòu)造方法比較奇怪:
              /**
               * Do nothing but only return null
               
          */

              
          public ChannelIF createChannel(String title, String location) {
                  
          // TODO Auto-generated method stub
                  return null;
              }


              
          /**
               * Do nothing but only return null
               
          */

              
          public ChannelIF createChannel(Element channelElement, String title,
                      String location) 
          {
                  
          // TODO Auto-generated method stub
                  return null;
              }


              
          public ChannelIF createChannel(String title) {
                  
          return new Channel(title);
              }


              
          public ChannelIF createChannel(Element channelElement, String title) {
                  
          return new Channel(channelElement, title);
              }

          根據(jù)RSS 2.0規(guī)范,一個(gè)Channel有3個(gè)必選元素:title, link, description。實(shí)在不明白為什么在Informa的實(shí)現(xiàn)中為什么對第一個(gè),第二個(gè)方法直接返回null,而且不給出任何提示?從代碼的注釋來看應(yīng)該是靠IDE自動生成的,可能作者忘了實(shí)現(xiàn)。開源軟件啊~~~,有時(shí)真的不知道怎么說好!

          第二類方法方法是元素構(gòu)造方法,這包括了一系列以createXxx形式的方法:


          第三類方法就是事務(wù)控制方法,Informa中對于basic并沒有提供真正的事務(wù)控制實(shí)現(xiàn),它明確告訴我們“The following methods are only meaningful for persistent informa back end implementations such as Hibernate and are no-ops otherwise.”。也就是這些方法只在Informa使用Hibernate進(jìn)行后端持久化時(shí)才有意義。對于其它情況下來說只是一個(gè)“no-ops”:停止操作命令。


          -------------------------------------------------------------
          生活就像打牌,不是要抓一手好牌,而是要盡力打好一手爛牌。
          posted on 2009-12-22 23:52 Paul Lin 閱讀(1278) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          <2009年12月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          常用鏈接

          留言簿(21)

          隨筆分類

          隨筆檔案

          BlogJava熱點(diǎn)博客

          好友博客

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 延寿县| 开化县| 农安县| 册亨县| 加查县| 盐亭县| 鸡东县| 尼玛县| 时尚| 山阴县| 海丰县| 吴旗县| 都安| 尼玛县| 铜山县| 通辽市| 和顺县| 西吉县| 姚安县| 林芝县| 大竹县| 涡阳县| 怀远县| 深水埗区| 林口县| 吉木乃县| 大石桥市| 晴隆县| 襄垣县| 凉山| 崇义县| 若羌县| 五常市| 昭平县| 临猗县| 兴仁县| 丹寨县| 甘德县| 富蕴县| 贺兰县| 卓尼县|