1 package spoon.support.reflect.code; 2 3 import java.util.ArrayList ; 4 import java.util.List ; 5 6 import spoon.reflect.code.CtExpression; 7 import spoon.reflect.code.CtNewClass; 8 import spoon.reflect.code.CtStatement; 9 import spoon.reflect.code.CtStatementList; 10 import spoon.reflect.declaration.CtClass; 11 import spoon.reflect.declaration.CtElement; 12 import spoon.reflect.reference.CtExecutableReference; 13 import spoon.reflect.visitor.CtVisitor; 14 15 public class CtNewClassImpl<T> extends 16 CtTargetedExpressionImpl<T, CtExpression<?>> implements CtNewClass<T> { 17 private static final long serialVersionUID = 1L; 18 19 CtClass annonymousClass; 20 21 List <CtExpression<?>> arguments = new ArrayList <CtExpression<?>>(); 22 23 CtExecutableReference<T> executable; 24 25 String label; 26 27 public void accept(CtVisitor visitor) { 28 visitor.visitCtNewClass(this); 29 } 30 31 public CtClass<?> getAnonymousClass() { 32 return annonymousClass; 33 } 34 35 public List <CtExpression<?>> getArguments() { 36 return arguments; 37 } 38 39 public CtExecutableReference<T> getExecutable() { 40 return executable; 41 } 42 43 public String getLabel() { 44 return label; 45 } 46 47 public void insertAfter(CtStatement statement) { 48 CtStatementImpl.insertAfter(this, statement); 49 } 50 51 public void insertBefore(CtStatement statement) { 52 CtStatementImpl.insertBefore(this, statement); 53 } 54 55 public void insertAfter(CtStatementList statements) { 56 CtStatementImpl.insertAfter(this, statements); 57 } 58 59 public void insertBefore(CtStatementList statements) { 60 CtStatementImpl.insertBefore(this, statements); 61 } 62 63 public void replace(CtElement element) { 64 if (element instanceof CtStatementList) { 65 CtStatementImpl.replace(this, (CtStatementList) element); 66 } else { 67 super.replace(element); 68 } 69 } 70 71 public void setAnonymousClass(CtClass annonymousClass) { 72 this.annonymousClass = annonymousClass; 73 } 74 75 public void setArguments(List <CtExpression<?>> arguments) { 76 this.arguments = arguments; 77 } 78 79 public void setExecutable(CtExecutableReference<T> executable) { 80 this.executable = executable; 81 } 82 83 public void setLabel(String label) { 84 this.label = label; 85 } 86 87 } 88 | Popular Tags |