編程生活

             :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            113 隨筆 :: 0 文章 :: 18 評論 :: 0 Trackbacks
          見下面的文檔描述:
          The EJB 3.0 programming model supports the use of generics in the business interface at the class level.

          BEA recommends as a best practice that you first define a super-interface that uses the generics, and then have the actual business interface extend this super-interface with a specific data type.

          The following example shows how to do this. First program the super-interface that uses generics:

            public interface RootI<T> {
              public T getObject();
          public void updateObject(T object);
          }

          Then program the actual business interface to extend Root*<T> for a particular data type:

            @Remote
          public interface StatelessI extends RootI<String> { }

          Finally, program the actual stateless session bean to implement the business interface; use the specified data type, in this case String, in the implementation of the methods:

            @Stateless
          public class StatelessSample implements StatelessI {
          public String getObject() {
          return null;
          }
          public void updateObject(String object) {
          }
          }
          posted on 2008-04-08 13:47 wilesun 閱讀(262) 評論(0)  編輯  收藏

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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 南岸区| 东乌珠穆沁旗| 会理县| 会宁县| 姚安县| 新乐市| 马龙县| 交城县| 襄垣县| 奇台县| 丹棱县| 阳谷县| 章丘市| 牡丹江市| 蓝山县| 南康市| 温宿县| 晋江市| 曲沃县| 凌云县| 丹阳市| 吴旗县| 克东县| 石嘴山市| 运城市| 临颍县| 广水市| 绥江县| 古浪县| 林芝县| 榕江县| 同德县| 普兰县| 塔城市| 岐山县| 岳阳县| 日照市| 成安县| 通渭县| 来宾市| 宝山区|