code: private boolean isValidCommandMethod(Object service, String commandName) {
          try {
              service.getClass().getMethod(commandName, PrintWriter.class, String[].class);
              return true;
          } catch (NoSuchMethodException e) {
              return false;
          }
      }
docs: Validate Command method
  
  @param service     service instance
  @param commandName command method name
  @return <code>true</code> if method is peresent in service, <code>public</code> and
  has params <code>PrintStream</code> and <code>String[]</code>, otherwise - <code>false</code>