Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: javax/ide/model/java/source/tree/AnnotationT.java


1   /*
2    * @(#)AnnotationT.java
3    */
4   
5   package javax.ide.model.java.source.tree;
6   
7   import java.util.List;
8   
9   /**
10   * An annotation (not to be confused with annotation type).  Any
11   * declaration may be annotated, in particular, that means any T that
12   * extends HasModifiersT. <p/>
13   * 
14   * For more information, please refer to the JLS 3rd ed, section
15   * 9.7. <p/>
16   * 
17   * The first annotation variant is called a "normal" annotation.
18   * Consider: <p/>
19   *
20   * <pre>
21   *   // Normal annotation
22   *   {@literal @}RequestForEnhancement(
23   *     id = 2868724,
24   *     synopsis = "Provide time-travel functionality",
25   *     engineer = "Mr. Peabody",
26   *     date = "4/1/2004"
27   *   )
28   *   public static void travelThroughTime(Date destination) { ... }
29   * </pre>
30   *
31   * getArguments() will return a list of four elements, each one will be
32   * an AssignmentExpressionT. The first argument will have a lhs for
33   * "id" and a rhs for "2868724". <p/>
34   * 
35   * The second annotation variant is called a "marker"
36   * annotation. Consider: <p/>
37   *
38   * <pre>
39   *   {@literal @}Deprecated
40   *   class MyClass { }
41   * </pre>
42   *
43   * getArguments() will return an empty list. In particular,
44   * getArgumentList() will return a synthetic ListExpressionT. <p/>
45   * 
46   * The third annotation variant is called a "single-element"
47   * annotation.  Consider: <p/>
48   *
49   * <pre>
50   *   // Single-element annotation
51   *   {@literal @}Copyright("2002 Yoyodyne Propulsion Systems, Inc., ...")
52   *   public class OscillationOverthruster { ... } * </pre>
53   * </pre>
54   *
55   * getArguments() will return a list of one element. The single argument
56   * will be an expression for "2002 Yoydyne..." etc. Note: This single
57   * argument will NOT be an AssignmentExpressionT. <p/>
58   * 
59   * @see HasModifiersT
60   *
61   * @author Andy Yu
62   */
63  public interface AnnotationT
64    extends Tree, HasNameT
65  {
66    // ----------------------------------------------------------------------
67  
68    /**
69     * Gets the argument list as a tree.
70     *
71     * @return The argument list expression used to construct this annotation.
72     * Always non-null. If this is a marker annotation, then the returned
73     * ListExpressionT will be marked synthetic. Adding a child to said
74     * argument list will automatically remove the synthetic modifier.
75     */
76    public ListExpressionT getArgumentList();
77  
78    /**
79     * Gets the arguments as a list.
80     * 
81     * @return The List of expressions used to construct this annotation.
82     * <p/>
83     *
84     * List of ExpressionTs.
85     */
86    public List getArguments();
87    
88    /**
89     * Gets the number of arguments.  Equivalent to calling
90     * <code>getArgumentList().getOperandCount()</code> or
91     * <code>getArguments().size()</code>.
92     *
93     * @return The size of the argument list expression.
94     */
95    public int getArgumentCount();
96  
97    /**
98     * Gets the indicated argument.  Equivalent to calling
99     * <code>getArgumentList().getOperandAt(i)</code> or
100    * <code>getArguments().get(i)</code>.
101    *
102    * @param i 0-based.
103    * 
104    * @return The argument at the given index.
105    */
106   public ExpressionT getArgumentAt( int i );
107 }