Example #1
0
 public void setDefaultCommandClass(final Class<?> defaultCommandClass) {
   final CmdCommand anno = defaultCommandClass.getAnnotation(CmdCommand.class);
   if (anno == null) {
     throw new IllegalArgumentException(
         "Given class is not annotated with @" + CmdCommand.class.getSimpleName());
   }
   if (anno.names() == null || anno.names().length == 0 || anno.names()[0].length() == 0) {
     throw new IllegalArgumentException("Given default command class has no valid name");
   }
   setDefaultCommandName(anno.names()[0]);
 }