View Javadoc

1   package com.lexicalscope.jewel.cli;
2   
3   import java.lang.annotation.ElementType;
4   import java.lang.annotation.Retention;
5   import java.lang.annotation.RetentionPolicy;
6   import java.lang.annotation.Target;
7   
8   /**
9    * Tags a method as returning any unparsed arguments
10   *
11   * @author Tim Wood
12   */
13  @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface Unparsed
14  {
15      /**
16       * The name to use when describe the unparsed arguments in help text and
17       * error messages
18       *
19       * @return The name to use when describe the unparsed arguments in help text
20       *         and error messages
21       */
22      String name() default "ARGUMENTS";
23  
24      /**
25       * The regexp that the values of this option must match
26       *
27       * @return The regexp that the values of this option must match
28       */
29      String pattern() default ".*";
30  
31      /**
32       * A description of this option
33       *
34       * @return A description of this option
35       */
36      String description() default "";
37  
38      /**
39       * The default value if none is specified
40       *
41       * @return The value to present if none is specified
42       */
43      String[] defaultValue() default { Option.stringToMarkNoDefault };
44  
45      /**
46       * The default value is null. Java does not allow null values in
47       * annotations. Setting this attribute to true will default the value of the
48       * option to null.
49       *
50       * @return true iff the default value of the option should be null
51       */
52      boolean defaultToNull() default false;
53  
54      /**
55       * Option is not displayed in help messages. Probably best not to use this with mandatory options.
56       *
57       * @return the option is not displayed in any help messages
58       */
59      boolean hidden() default false;
60  
61      /**
62       * Multivalued option must have at least this many values
63       *
64       * @return Multivalued option must have at least this many values
65       */
66      int minimum() default -1;
67  
68      /**
69       * Multivalued option must have exactly this many values
70       *
71       * @return Multivalued option must have exactly this many values
72       */
73      int exactly() default -1;
74  
75      /**
76       * Multivalued option can have at most this many values
77       *
78       * @return Multivalued option can have at most this many values
79       */
80      int maximum() default Integer.MAX_VALUE;
81  }