KickJava   Java API By Example, From Geeks To Geeks.

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


1 package spoon.support.reflect.reference;
2
3 import java.lang.annotation.Annotation JavaDoc;
4 import java.util.ArrayList JavaDoc;
5 import java.util.List JavaDoc;
6
7 import spoon.reflect.reference.CtTypeParameterReference;
8 import spoon.reflect.reference.CtTypeReference;
9 import spoon.reflect.visitor.CtVisitor;
10
11 public class CtTypeParameterReferenceImpl extends CtTypeReferenceImpl<Object JavaDoc>
12         implements CtTypeParameterReference {
13     private static final long serialVersionUID = 1L;
14
15     List JavaDoc<CtTypeReference> bounds = new ArrayList JavaDoc<CtTypeReference>();
16
17     boolean upper = true;
18
19     public CtTypeParameterReferenceImpl() {
20         super();
21     }
22
23     @Override JavaDoc
24     public void accept(CtVisitor visitor) {
25         visitor.visitCtTypeParameterReference(this);
26     }
27
28     @Override JavaDoc
29     public <A extends Annotation JavaDoc> A getAnnotation(Class JavaDoc<A> annotationType) {
30         return null;
31     }
32
33     public List JavaDoc<CtTypeReference> getBounds() {
34         return bounds;
35     }
36
37     public boolean isUpper() {
38         return upper;
39     }
40
41     public void setBounds(List JavaDoc<CtTypeReference> bounds) {
42         this.bounds = bounds;
43     }
44
45     public void setUpper(boolean upper) {
46         this.upper = upper;
47     }
48
49     @Override JavaDoc
50     public boolean isAssignableFrom(CtTypeReference<?> type) {
51         return false;
52     }
53
54     @Override JavaDoc
55     public boolean isSubtypeOf(CtTypeReference<?> type) {
56         return false;
57     }
58     
59     @Override JavaDoc
60     public boolean isPrimitif() {
61         return false;
62     }
63
64     public void setSimpleName(String JavaDoc simplename) {
65         this.simplename = simplename;
66     }
67
68     @SuppressWarnings JavaDoc("unchecked")
69     public Class JavaDoc<Object JavaDoc> getActualClass() {
70         if(isUpper()) {
71             if(getBounds().isEmpty()) {
72                 return Object JavaDoc.class;
73             } else {
74                 return (Class JavaDoc)getBounds().get(0).getActualClass();
75             }
76         }
77         return null;
78     }
79     
80 }
81
Popular Tags