KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > spoon > support > reflect > reference > CtVariableReferenceImpl


1 package spoon.support.reflect.reference;
2
3 import java.util.Set JavaDoc;
4 import java.util.TreeSet JavaDoc;
5
6 import spoon.reflect.declaration.CtVariable;
7 import spoon.reflect.declaration.ModifierKind;
8 import spoon.reflect.reference.CtTypeReference;
9 import spoon.reflect.reference.CtVariableReference;
10
11 public abstract class CtVariableReferenceImpl<T> extends CtReferenceImpl
12         implements CtVariableReference<T> {
13     private static final long serialVersionUID = 1L;
14     CtTypeReference<T> type;
15
16     public CtVariableReferenceImpl() {
17         super();
18     }
19
20     public CtTypeReference<T> getType() {
21         return type;
22     }
23
24     public void setType(CtTypeReference<T> type) {
25         this.type = type;
26     }
27
28     @Override JavaDoc
29     public boolean equals(Object JavaDoc object) {
30         if (!(object instanceof CtVariableReference))
31             return false;
32         CtVariableReference<?> ref = (CtVariableReference) object;
33         return this.type.equals(ref.getType())
34                 && this.simplename.equals(ref.getSimpleName());
35     }
36
37     public Set JavaDoc<ModifierKind> getModifiers() {
38         CtVariable v=getDeclaration();
39         if(v!=null) {
40             return v.getModifiers();
41         } else {
42             return new TreeSet JavaDoc<ModifierKind>();
43         }
44     }
45     
46 }
47
Popular Tags