Package org.crsh.cli.descriptor

Examples of org.crsh.cli.descriptor.Description


        methodDescriptor.addParameter(parameter);
      }
      return methodDescriptor;
    } else {
      Map<String, MethodDescriptor<T>> methodMap = new LinkedHashMap<String, MethodDescriptor<T>>();
      ClassDescriptor<T> classDescriptor = new ClassDescriptor<T>(type, commandName, methodMap, new Description(type));
      for (Method method : methods) {
        String methodName;
        if (method.getAnnotation(Named.class) != null) {
          methodName = method.getAnnotation(Named.class).value();
        } else {
View Full Code Here


      return classDescriptor;
    }
  }

  private <T> MethodDescriptor<T> create(ClassDescriptor<T> classDescriptor, String name, Method method) throws IntrospectionException {
    Description info = new Description(method);
    MethodDescriptor<T> methodDescriptor = new MethodDescriptor<T>(
        classDescriptor,
        method,
        name,
        info);
View Full Code Here

  private static Tuple get(Annotation... ab) {
    Argument argumentAnn = null;
    Option optionAnn = null;
    Boolean required = null;
    Description description = new Description(ab);
    Annotation info = null;
    for (Annotation parameterAnnotation : ab) {
      if (parameterAnnotation instanceof Option) {
        optionAnn = (Option)parameterAnnotation;
      } else if (parameterAnnotation instanceof Argument) {
        argumentAnn = (Argument)parameterAnnotation;
      } else if (parameterAnnotation instanceof Required) {
        required = ((Required)parameterAnnotation).value();
      } else if (info == null) {

        // Look at annotated annotations
        Class<? extends Annotation> a = parameterAnnotation.annotationType();
        if (a.getAnnotation(Option.class) != null) {
          optionAnn = a.getAnnotation(Option.class);
          info = parameterAnnotation;
        } else if (a.getAnnotation(Argument.class) != null) {
          argumentAnn =  a.getAnnotation(Argument.class);
          info = parameterAnnotation;
        }

        //
        if (info != null) {

          //
          description = new Description(description, new Description(a));

          //
          if (required == null) {
            Required metaReq = a.getAnnotation(Required.class);
            if (metaReq != null) {
View Full Code Here

      public Command<?> getCommand() throws CommandException {

        //
        final CommandDescriptor<Object> descriptor;
        try {
          descriptor = new CommandDescriptor<Object>(name, new Description()) {
            @Override
            public CommandDescriptor<Object> getOwner() {
              return null;
            }
View Full Code Here

    class A { }

    CommandDescriptor<Instance<A>> c = CommandFactory.DEFAULT.create(A.class);
    assertEquals("", c.getUsage());
    assertEquals(new Description(), c.getDescription());
  }
View Full Code Here

    CommandDescriptor<Instance<A>> c = CommandFactory.DEFAULT.create(A.class);
    CommandDescriptor<Instance<A>> m = c.getSubordinate("m");
    OptionDescriptor a = m.getOption("-a");
    assertEquals("", a.getUsage());
    assertEquals(new Description(), a.getDescription());
  }
View Full Code Here

TOP

Related Classes of org.crsh.cli.descriptor.Description

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.