- Timestamp:
- 08/30/12 17:04:16 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/java-utils/src/main/java/de/ugoe/cs/util/console/CommandExecuter.java
r669 r718 155 155 * otherwise 156 156 */ 157 p rivateCommand loadCMD(String className) {157 public Command loadCMD(String className) { 158 158 Command cmd = null; 159 159 try { … … 171 171 catch (ClassCastException e) { 172 172 Console.traceln(Level.WARNING, className + "found, but does not implement Command"); 173 } 174 return cmd; 175 } 176 177 /** 178 * <p> 179 * Helper method that loads a class and tries to cast it to {@link Command}. 180 * </p> 181 * 182 * @param className 183 * qualified name of the class (including package name) 184 * @return if class is available and implement {@link Command} and instance of the class, null 185 * otherwise 186 */ 187 public Command getCMD(String commandName) { 188 Command cmd = null; 189 for (int i = 0; cmd == null && i < commandPackageList.size(); i++) { 190 cmd = loadCMD(commandPackageList.get(i) + "." + cmdPrefix + commandName); 191 } 192 if (cmd == null) { // check if command is available as default command 193 cmd = loadCMD(defaultPackage + "." + cmdPrefix + commandName); 173 194 } 174 195 return cmd;
Note: See TracChangeset
for help on using the changeset viewer.