WebSphere Application Server - Express for i5/OS, Version 6.1   
             オペレーティング・システム: i5/OS

             目次と検索結果のパーソナライズ化

例: コマンド・インターフェースからのメソッドの実装

Command インターフェースは、アプリケーション・プログラマーが実装する必要がある 2 つの メソッドである isReadyToCallExecute および reset を宣言します。

ModifyCheckingAccountCmdImpl クラス内の Command インターフェースからのメソッド

以下のコード例に、ModifyCheckingAccountCmd コマンドの実装を示します。 isReadyToCallExecute メソッドの実装により、 checkingAccount 変数が確実に設定されます。reset メソッドは、すべての変数を 開始値に戻します。

...
public class ModifyCheckingAccountCmdImpl extends TargetableCommandImpl
implements ModifyCheckingAccountCmd
{
...
// Methods from the Command interface
public boolean isReadyToCallExecute() {
if (checkingAccount != null)
return true;
else
return false;
}
public void reset() {
amount = 0;
balance = 0;
oldBalance = 0;
checkingAccount = null;
targetPolicy = new TargetPolicyDefault();
}
...
}



関連タスク
コマンド・インターフェースの実装
参照トピック    

ご利用条件 | フィードバック

最終更新: Jan 21, 2008 7:05:28 PM EST
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.express.iseries.doc/info/iseriesexp/ae/rcmd_implmethcmdint.html