KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > spoon > reflect > reference > CtReference


1 package spoon.reflect.reference;
2
3 import java.lang.annotation.Annotation JavaDoc;
4
5 import spoon.processing.FactoryAccessor;
6 import spoon.reflect.declaration.CtElement;
7 import spoon.reflect.visitor.CtVisitor;
8 import spoon.reflect.visitor.Root;
9
10 /**
11  * This is the root inferface for program element references. References can
12  * point to program element reified in the metamodel or not. In the latter case,
13  * introspection methods fall back on runtime reflection (<code>java.lang.reflect</code>)
14  * to access the program information, as long as available in the classpath.
15  *
16  * @see spoon.reflect.declaration.CtElement
17  */

18 @Root
19 public interface CtReference extends FactoryAccessor, Comparable JavaDoc<CtReference> {
20
21     /**
22      * Searches for an annotation defined on this element.
23      *
24      * @param annotationType
25      * the annotation type to search for
26      * @return a proxy to the annotation or null if not found
27      */

28     <A extends Annotation JavaDoc> A getAnnotation(Class JavaDoc<A> annotationType);
29
30     /**
31      * Gets all the annotations defined on this element.
32      *
33      * @return an array of annotation proxies
34      */

35     Annotation JavaDoc[] getAnnotations();
36
37     /**
38      * Gets the simple name of referenced element.
39      */

40     String JavaDoc getSimpleName();
41
42     /**
43      * Sets the name of referenced element.
44      */

45     void setSimpleName(String JavaDoc simpleName);
46
47     /**
48      * Tries to get the declaration that corresponds to the referenced element.
49      *
50      * @return referenced element or null if element does not exist
51      */

52     CtElement getDeclaration();
53
54     /**
55      * Accepts a visitor
56      */

57     void accept(CtVisitor visitor);
58
59 }
60
Popular Tags