📄 commandfactory.java
字号:
package agenda.command;import agenda.Exception.*;/** * Command factory * @author wc */public class CommandFactory { public Command getCommand(String command) throws Exception, NoSuchCommandException { String[] args = command.split(" ", 0); String className = "agenda.command." + args[0].toUpperCase(); try{ Class cls = Class.forName(className); Command com = (Command)cls.newInstance(); com.parse(args); return com; } catch(ClassNotFoundException e){ throw new NoSuchCommandException(args[0]); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -