⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cartbean.java

📁 卡内基梅隆大学软件工程课件,很全面
💻 JAVA
字号:
/* * * Copyright 2001 Sun Microsystems, Inc. All Rights Reserved. *  * This software is the proprietary information of Sun Microsystems, Inc.   * Use is subject to license terms. *  */import java.util.*;import javax.ejb.*;public class CartBean implements SessionBean {   String customerName;   String customerId;   Vector contents;   public void ejbCreate(String person) throws CreateException {      if (person == null) {        throw new CreateException("Null person not allowed.");      }      else {         customerName = person;      }      customerId = "0";      contents = new Vector();   }   public void ejbCreate(String person, String id) throws CreateException {      if (person == null) {        throw new CreateException("Null person not allowed.");      }      else {         customerName = person;      }      IdVerifier idChecker = new IdVerifier();      if (idChecker.validate(id)) {         customerId = id;      }      else {         throw new CreateException("Invalid id: " + id);      }      contents = new Vector();   }   public void addBook(String title) {      contents.addElement(title);   }   public void removeBook(String title) throws BookException {      boolean result = contents.removeElement(title);      if (result == false) {         throw new BookException(title + " not in cart.");      }   }   public Vector getContents() {      return contents;   }   public CartBean() {}   public void ejbRemove() {}   public void ejbActivate() {}   public void ejbPassivate() {}   public void setSessionContext(SessionContext sc) {}} 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -