KickJava   Java API By Example, From Geeks To Geeks.

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


1 package spoon.support.reflect.declaration;
2
3 import spoon.reflect.declaration.CtConstructor;
4 import spoon.reflect.declaration.CtType;
5 import spoon.reflect.reference.CtTypeReference;
6 import spoon.reflect.visitor.CtVisitor;
7
8 public class CtConstructorImpl<T> extends CtExecutableImpl<T> implements
9         CtConstructor<T> {
10     private static final long serialVersionUID = 1L;
11
12     @Override JavaDoc
13     public void setSimpleName(String JavaDoc simpleName) {
14         throw new RuntimeException JavaDoc("Operation not allowed");
15     }
16
17     @Override JavaDoc
18     public String JavaDoc getSimpleName() {
19         return "<init>";
20     }
21
22     public void accept(CtVisitor visitor) {
23         visitor.visitCtConstructor(this);
24     }
25
26     // public CtType<T> getDeclaringType() {
27
// return super.getDeclaringType();
28
// }
29

30     @SuppressWarnings JavaDoc("unchecked")
31     public CtType<T> getDeclaringType() {
32         return (CtType<T>) parent;
33     }
34     
35     public CtTypeReference<T> getType() {
36         if(getDeclaringType()==null) return null;
37         return getDeclaringType().getReference();
38     }
39
40     public void setType(CtTypeReference<T> type) {
41     }
42
43     public boolean isImplicitDefault() {
44         if(getDeclaringType()==null) return false;
45         if(getDeclaringType().getPosition()==null || getPosition()==null) return false;
46         return getDeclaringType().getPosition().equals(getPosition());
47     }
48     
49 }
50
Popular Tags