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 13 public void setSimpleName(String simpleName) { 14 throw new RuntimeException ("Operation not allowed"); 15 } 16 17 @Override 18 public String getSimpleName() { 19 return "<init>"; 20 } 21 22 public void accept(CtVisitor visitor) { 23 visitor.visitCtConstructor(this); 24 } 25 26 30 @SuppressWarnings ("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 |