Package org.crsh.cli.impl.descriptor

Examples of org.crsh.cli.impl.descriptor.IntrospectionException


      Annotation ann) throws IntrospectionException {

    //
    if (argumentAnn != null) {
      if (optionAnn != null) {
        throw new IntrospectionException();
      }

      //
      return new BoundArgumentDescriptor(
          binding,
View Full Code Here


      }
      for (MethodDescriptor<T> method : methods.values()) {
        Set<String> diff = new HashSet<String>(method.getOptionNames());
        diff.retainAll(blah);
        if (diff.size() > 0) {
          throw new IntrospectionException("Cannot add method " + method.getName() + " because it has common "
          + " options with its class: " + diff);
        }
      }
    }
View Full Code Here

  protected CommandDescriptor(String name, Description description) throws IntrospectionException {

    //
    int nameLength = name.length();
    if (nameLength == 0) {
      throw new IntrospectionException("Command name cannot be null");
    } else {
      for (int i = 0;i < nameLength;i++) {
        char c = name.charAt(i);
        if (i == 0) {
          if (!Character.isLetter(c)) {
            throw new IntrospectionException("Invalid command name <" + name + "> does not start with a letter");
          }
        } else {
          if (!Character.isLetter(c) && !Character.isDigit(c) && c != '_' && c != '-') {
            throw new IntrospectionException("Invalid command name <" + name + "> char " + c + " at position " + i + " is now allowed");
          }
        }
      }
    }
View Full Code Here

      for (String optionName : option.getNames()) {
        String name;
        if (optionName.length() == 1) {
          name = "-" + optionName;
          if (shortOptionNames.contains(name)) {
            throw new IntrospectionException("Duplicate option " + name);
          } else {
            shortOptionNames.add(name);
          }
        } else {
          name = "--" + optionName;
          if (longOptionNames.contains(name)) {
            throw new IntrospectionException();
          } else {
            longOptionNames.add(name);
          }
        }
        optionMap.put(name, option);
      }
      options.add(option);
      ListIterator<ParameterDescriptor> i = parameters.listIterator();
      while (i.hasNext()) {
        ParameterDescriptor next = i.next();
        if (next instanceof ArgumentDescriptor) {
          i.previous();
          break;
        }
      }
      i.add(parameter);
    } else if (parameter instanceof ArgumentDescriptor) {
      ArgumentDescriptor argument = (ArgumentDescriptor)parameter;
      if (argument.getMultiplicity() == Multiplicity.MULTI) {
        if (listArgument) {
          throw new IntrospectionException();
        }
        listArgument = true;
      }
      arguments.add(argument);
      parameters.add(argument);
View Full Code Here

TOP

Related Classes of org.crsh.cli.impl.descriptor.IntrospectionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.