KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > spoon > reflect > reference > CtTypeReference


1 package spoon.reflect.reference;
2
3 import java.util.Collection JavaDoc;
4 import java.util.Set JavaDoc;
5
6 import spoon.reflect.declaration.CtSimpleType;
7
8 /**
9  * This interface defines a reference to a
10  * {@link spoon.reflect.declaration.CtType} or sub-type.
11  */

12 public interface CtTypeReference<T> extends CtReference,
13         CtGenericElementReference, CtModifiableReference {
14     
15     /**
16      * The name of the null type ("&lt;nulltype&gt;").
17      */

18     public static final String JavaDoc nulltype = "<nulltype>";
19
20     /**
21      * Gets the Java runtime class of the referenced type.
22      *
23      * @return the Java class or null if the class is not found (not in
24      * classpath)
25      */

26     Class JavaDoc<T> getActualClass();
27
28     CtSimpleType<T> getDeclaration();
29
30     /**
31      * Gets the type that declares the referenced type.
32      *
33      * @return the declaring type if this references an inner class; null in
34      * other cases
35      */

36     CtTypeReference<?> getDeclaringType();
37
38     /**
39      * Gets the package of the referenced type.
40      *
41      * @return the declaring package or null if this if a inner class
42      */

43     CtPackageReference getPackage();
44
45     /**
46      * Gets the qualified name.
47      *
48      * @return the fully-qualified name of the referenced type
49      */

50     String JavaDoc getQualifiedName();
51
52     /**
53      * Returns <code>true</code> if this referenced type is assignable from an
54      * instance of the given type.
55      */

56     boolean isAssignableFrom(CtTypeReference<?> type);
57
58     /**
59      * Return {@code true} if the referenced type is a primitive type (int,
60      * double, boolean...).
61      */

62     boolean isPrimitif();
63
64     /**
65      * Returns the corresponding non-primitive type for a primitive type (the
66      * same type otherwhise).
67      */

68     CtTypeReference<?> box();
69
70     /**
71      * Returns the primitive type for a boxing type (unchanged if the type does
72      * not correspond to a boxing type).
73      */

74     CtTypeReference<?> unbox();
75
76     /**
77      * Returns true if the referenced type is a sub-type of the given type.
78      */

79     boolean isSubtypeOf(CtTypeReference<?> type);
80
81     /**
82      * Sets the reference to the declaring type. Should be set to null if the
83      * referenced type is not a inner type.
84      */

85     void setDeclaringType(CtTypeReference type);
86
87     /**
88      * Sets the reference to the declaring package.
89      */

90     void setPackage(CtPackageReference pack);
91
92     /**
93      * Gets the fields declared by this type.
94      */

95     Collection JavaDoc<CtFieldReference> getDeclaredFields();
96
97     /**
98      * Gets the fields declared by this type and by all its supertypes if
99      * applicable.
100      */

101     Collection JavaDoc<CtFieldReference> getAllFields();
102
103     /**
104      * Gets the executables declared by this type if applicable.
105      */

106     Collection JavaDoc<CtExecutableReference> getDeclaredExecutables();
107
108     /**
109      * Gets the executables declared by this type and by all its supertypes if
110      * applicable.
111      */

112     Collection JavaDoc<CtExecutableReference> getAllExecutables();
113
114     /**
115      * Gets the superclass of this type if applicable (only for classes).
116      */

117     CtTypeReference<?> getSuperclass();
118
119     /**
120      * Gets the super interfaces of this type.
121      */

122     Set JavaDoc<CtTypeReference<?>> getSuperInterfaces();
123
124 }
125
Popular Tags