View Javadoc

1   /*
2    * This file is part of hyphenType. hyphenType is free software: you can
3    * redistribute it and/or modify it under the terms of the GNU General Public
4    * License as published by the Free Software Foundation, either version 3 of the
5    * License, or (at your option) any later version. hyphenType is distributed in
6    * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
7    * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
8    * the GNU General Public License for more details. You should have received a
9    * copy of the GNU General Public License along with hyphenType. If not, see
10   * <http://www.gnu.org/licenses/>.
11   */
12  package org.hyphenType.datastructure.annotations;
13  
14  import java.lang.annotation.ElementType;
15  import java.lang.annotation.Retention;
16  import java.lang.annotation.RetentionPolicy;
17  import java.lang.annotation.Target;
18  
19  /**
20   * @author Aurelio Akira M. Matsui
21   */
22  @Retention(RetentionPolicy.RUNTIME)
23  @Target(ElementType.METHOD)
24  public @interface SimpleArgument {
25  
26      String name() default "";
27  
28      /**
29       * The index of this simple argument. Each simple argument
30       * should have a <strong>unique</strong> index. Indexes should
31       * be a sequence in the form 0, 1, ...<br>
32       * <br>
33       * This property has 0 as the default value to keep the code
34       * clean when there is only one argument.<br>
35       * <br>
36       * But it is not advisable to omit the index when using more than
37       * one option argument since it is harder to read. This is a
38       * counter example:<br>
39       * 
40       * <code><pre>
41       * &#64;SimpleArgument
42       * String arg1();
43       * 
44       * &#64;SimpleArgument(index=1)
45       * String arg2();
46       * </pre></code>
47       * The following is more readable:<br>
48       * <code><pre>
49       * &#64;SimpleArgument(index=0)
50       * String arg1();
51       * 
52       * &#64;SimpleArgument(index=1)
53       * String arg2();
54       * </pre></code>
55       * 
56       * @return
57       */
58      int index() default 0;
59  
60      String description() default "";
61  
62      String regex() default "[^\\Q\\h\\E&^\\Q\\H\\E].*";
63  
64      boolean mandatory() default false;
65  
66      InputChannel[] channels() default InputChannel.ARGUMENT;
67  }