CommandContext負責傳遞一些象log之類的信息
這個execute返回一個Object
我們允許這個函數拋出任何異常
然後
java代碼
class ReturnCommand implements Command{
private final Object v;
public Object execute(CommandContext ctxt){
return v;
}
ReturnCommand(Object v){this
}
PrintCommand負責打印一句話
java代碼
class PrintCommand implements Command{
private final String msg;
public Object execute(CommandContext ctxt){
ctxt
return null;
}
PrintCommand(String msg){this
}
[
From:http://tw.wingwit.com/Article/program/Java/ky/201311/29270.html