Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.5.0)

E13403-06


javax.ide.model.java.source.tree
Interface AnnotationT

All Superinterfaces:
HasNameT, Tree

public interface AnnotationT
extends Tree, HasNameT

An annotation (not to be confused with annotation type). Any declaration may be annotated, in particular, that means any T that extends HasModifiersT.

For more information, please refer to the JLS 3rd ed, section 9.7.

The first annotation variant is called a "normal" annotation. Consider:

   // Normal annotation
   @RequestForEnhancement(
     id = 2868724,
     synopsis = "Provide time-travel functionality",
     engineer = "Mr. Peabody",
     date = "4/1/2004"
   )
   public static void travelThroughTime(Date destination) { ... }
 

getArguments() will return a list of four elements, each one will be an AssignmentExpressionT. The first argument will have a lhs for "id" and a rhs for "2868724".

The second annotation variant is called a "marker" annotation. Consider:

   @Deprecated
   class MyClass { }
 

getArguments() will return an empty list. In particular, getArgumentList() will return a synthetic ListExpressionT.

The third annotation variant is called a "single-element" annotation. Consider:

   // Single-element annotation
   @Copyright("2002 Yoyodyne Propulsion Systems, Inc., ...")
   public class OscillationOverthruster { ... } * 

getArguments() will return a list of one element. The single argument will be an expression for "2002 Yoydyne..." etc. Note: This single argument will NOT be an AssignmentExpressionT.

See Also:
HasModifiersT

Field Summary
static AnnotationT[] EMPTY_ARRAY
           

 

Method Summary
 ExpressionT getArgumentAt(int i)
          Gets the indicated argument.
 int getArgumentCount()
          Gets the number of arguments.
 ListExpressionT getArgumentList()
          Gets the argument list as a tree.

 

Methods inherited from interface javax.ide.model.java.source.tree.HasNameT
getName, getNameElement, setName, setNameElement

 

Methods inherited from interface javax.ide.model.java.source.tree.Tree
accept, addSelf, addSelf, addSelfAfter, addSelfBefore, clearProperty, cloneSelf, getChildren, getOwningFile, getParent, getPosition, getProperty, getSiblingAfter, getSiblingBefore, getSiblings, getTreeKind, isSynthetic, removeSelf, replaceSelf, setProperty

 

Field Detail

EMPTY_ARRAY

static final AnnotationT[] EMPTY_ARRAY

Method Detail

getArgumentList

ListExpressionT getArgumentList()
Gets the argument list as a tree.
Returns:
The argument list expression used to construct this annotation. Always non-null. If this is a marker annotation, then the returned ListExpressionT will be marked synthetic. Adding a child to said argument list will automatically remove the synthetic modifier.

getArgumentCount

int getArgumentCount()
Gets the number of arguments. Equivalent to calling getArgumentList().getOperandCount() or getArguments().size().
Returns:
The size of the argument list expression.

getArgumentAt

ExpressionT getArgumentAt(int i)
Gets the indicated argument. Equivalent to calling getArgumentList().getOperandAt(i) or getArguments().get(i).
Parameters:
i - 0-based.
Returns:
The argument at the given index.

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.5.0)

E13403-06


Copyright © 1997, 2011, Oracle. All rights reserved.