📄 digitalstorebean.java
字号:
/*
* Created on 2004-6-19
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package com.j2ee14.ch16;
import javax.ejb.SessionBean;
import javax.ejb.*;
/**
* @ejb.bean name="DigitalStore"
* jndi-name="ejb/DigitalStoreBean"
* type="Stateful"
*
*--
* This is needed for JOnAS.
* If you are not using JOnAS you can safely remove the tags below.
* @jonas.bean ejb-name="DigitalStore"
* jndi-name="DigitalStoreBean"
*
*--
**/
public abstract class DigitalStoreBean implements SessionBean {
String userId;
double eGold;
/** * @ejb.create-method * view-type="both" **/public void ejbCreate(String uid,double eg)throws CreateException{
if(eg<=0)
{
throw new CreateException("初始参数eg无效");
}
userId=uid;
eGold=eg; }/** * @ejb.interface-method * view-type="both" **/public void addEGold(double eg){
if(eg<=0){
return;
}
eGold+=eg;}
/**
* @ejb.interface-method
* view-type="both"
**/
public void withdrawEGold(double eg)throws NotMuchMoreEGoldException
{
if(eGold<eg)
{
throw new NotMuchMoreEGoldException();
}
eGold-=eg;
}
/**
* @ejb.interface-method
* view-type="both"
**/
public double getRemain ()
{
return eGold;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -