01: /*
02: * Spoon - http://spoon.gforge.inria.fr/
03: * Copyright (C) 2006 INRIA Futurs <renaud.pawlak@inria.fr>
04: *
05: * This software is governed by the CeCILL-C License under French law and
06: * abiding by the rules of distribution of free software. You can use, modify
07: * and/or redistribute the software under the terms of the CeCILL-C license as
08: * circulated by CEA, CNRS and INRIA at http://www.cecill.info.
09: *
10: * This program is distributed in the hope that it will be useful, but WITHOUT
11: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12: * FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL-C License for more details.
13: *
14: * The fact that you are presently reading this means that you have had
15: * knowledge of the CeCILL-C license and that you accept its terms.
16: */
17:
18: package spoon.reflect.reference;
19:
20: import java.lang.annotation.Annotation;
21:
22: import spoon.processing.FactoryAccessor;
23: import spoon.reflect.declaration.CtElement;
24: import spoon.reflect.visitor.CtVisitor;
25: import spoon.reflect.visitor.Root;
26:
27: /**
28: * This is the root inferface for program element references. References can
29: * point to program element reified in the metamodel or not. In the latter case,
30: * introspection methods fall back on runtime reflection (<code>java.lang.reflect</code>)
31: * to access the program information, as long as available in the classpath.
32: *
33: * @see spoon.reflect.declaration.CtElement
34: */
35: @Root
36: public interface CtReference extends FactoryAccessor,
37: Comparable<CtReference> {
38:
39: /**
40: * Searches for an annotation defined on this element.
41: *
42: * @param annotationType
43: * the annotation type to search for
44: * @return a proxy to the annotation or null if not found
45: */
46: <A extends Annotation> A getAnnotation(Class<A> annotationType);
47:
48: /**
49: * Gets all the annotations defined on this element.
50: *
51: * @return an array of annotation proxies
52: */
53: Annotation[] getAnnotations();
54:
55: /**
56: * Gets the simple name of referenced element.
57: */
58: String getSimpleName();
59:
60: /**
61: * Sets the name of referenced element.
62: */
63: void setSimpleName(String simpleName);
64:
65: /**
66: * Tries to get the declaration that corresponds to the referenced element.
67: *
68: * @return referenced element or null if element does not exist
69: */
70: CtElement getDeclaration();
71:
72: /**
73: * Accepts a visitor
74: */
75: void accept(CtVisitor visitor);
76:
77: }
|