KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > spoon > support > reflect > code > CtFieldAccessImpl


1 package spoon.support.reflect.code;
2
3 import spoon.reflect.code.CtExpression;
4 import spoon.reflect.code.CtFieldAccess;
5 import spoon.reflect.reference.CtFieldReference;
6 import spoon.reflect.reference.CtVariableReference;
7 import spoon.reflect.visitor.CtVisitor;
8
9 public class CtFieldAccessImpl<T> extends CtVariableAccessImpl<T> implements
10         CtFieldAccess<T> {
11     private static final long serialVersionUID = 1L;
12
13     CtExpression target;
14
15     public void accept(CtVisitor visitor) {
16         visitor.visitCtFieldAccess(this);
17     }
18
19     public CtExpression<?> getTarget() {
20         return target;
21     }
22
23     @SuppressWarnings JavaDoc("unchecked")
24     public CtFieldReference<T> getVariable() {
25         return (CtFieldReference<T>) super.getVariable();
26     }
27
28     public void setVariable(CtVariableReference<T> variable) {
29         if (!(variable instanceof CtFieldReference))
30             throw new RuntimeException JavaDoc("invalid type");
31         super.setVariable(variable);
32     }
33
34     public void setTarget(CtExpression target) {
35         this.target = target;
36     }
37
38 }
39
Popular Tags