KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > spoon > support > reflect > declaration > CtExecutableImpl


1 package spoon.support.reflect.declaration;
2
3 import java.util.ArrayList JavaDoc;
4 import java.util.List JavaDoc;
5 import java.util.Set JavaDoc;
6 import java.util.TreeSet JavaDoc;
7 import java.util.Vector JavaDoc;
8
9 import spoon.reflect.code.CtBlock;
10 import spoon.reflect.declaration.CtExecutable;
11 import spoon.reflect.declaration.CtParameter;
12 import spoon.reflect.reference.CtExecutableReference;
13 import spoon.reflect.reference.CtTypeReference;
14
15 /**
16  * The implementation for {@link spoon.reflect.declaration.CtExecutable}.
17  *
18  * @author Renaud Pawlak
19  */

20 public abstract class CtExecutableImpl<R> extends CtNamedElementImpl implements
21         CtExecutable<R> {
22
23     CtBlock<R> body;
24
25     List JavaDoc<CtTypeReference<?>> formalTypeParameters = new ArrayList JavaDoc<CtTypeReference<?>>();
26
27     List JavaDoc<CtParameter<?>> parameters = new Vector JavaDoc<CtParameter<?>>();
28
29     Set JavaDoc<CtTypeReference<? extends Throwable JavaDoc>> thrownTypes = new TreeSet JavaDoc<CtTypeReference<? extends Throwable JavaDoc>>();
30
31     public CtExecutableImpl() {
32         super();
33     }
34
35     public CtBlock<R> getBody() {
36         return body;
37     }
38
39     public List JavaDoc<CtTypeReference<?>> getFormalTypeParameters() {
40         return formalTypeParameters;
41     }
42
43     public List JavaDoc<CtParameter<?>> getParameters() {
44         return parameters;
45     }
46
47     public Set JavaDoc<CtTypeReference<? extends Throwable JavaDoc>> getThrownTypes() {
48         return thrownTypes;
49     }
50
51     public void setBody(CtBlock<R> body) {
52         this.body = body;
53     }
54
55     public void setFormalTypeParameters(
56             List JavaDoc<CtTypeReference<?>> formalTypeParameters) {
57         this.formalTypeParameters = formalTypeParameters;
58     }
59
60     public void setParameters(List JavaDoc<CtParameter<?>> parameters) {
61         this.parameters = parameters;
62     }
63
64     public void setThrownTypes(
65             Set JavaDoc<CtTypeReference<? extends Throwable JavaDoc>> thrownTypes) {
66         this.thrownTypes = thrownTypes;
67     }
68
69     @Override JavaDoc
70     public CtExecutableReference<R> getReference() {
71         return getFactory().Executable().createReference(this);
72     }
73
74     String JavaDoc getSignature() {
75         return getSimpleName().toString() + "(" + getParameters().toString()
76                 + ")";
77     }
78
79 }
80
Popular Tags