編程生活

             :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            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 閱讀(264) 評論(0)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 布拖县| 仙桃市| 曲靖市| 南阳市| 卢龙县| 大姚县| 梨树县| 宿州市| 巴塘县| 安图县| 三原县| 花莲市| 公安县| 彩票| 嵊泗县| 阿荣旗| 铜鼓县| 霸州市| 左云县| 盘锦市| 华容县| 永仁县| 吉首市| 文山县| 黑水县| 鄂尔多斯市| 梁河县| 进贤县| 连平县| 惠来县| 濮阳县| 满洲里市| 丘北县| 白银市| 金昌市| 婺源县| 南川市| 兴仁县| 太和县| 丰原市| 工布江达县|