1 package spoon.support.reflect.declaration; 2 3 import java.util.ArrayList ; 4 import java.util.List ; 5 import java.util.Set ; 6 import java.util.TreeSet ; 7 import java.util.Vector ; 8 9 import spoon.reflect.code.CtBlock; 10 import spoon.reflect.declaration.CtExecutable; 11 import spoon.reflect.declaration.CtParameter; 12 import spoon.reflect.reference.CtExecutableReference; 13 import spoon.reflect.reference.CtTypeReference; 14 15 20 public abstract class CtExecutableImpl<R> extends CtNamedElementImpl implements 21 CtExecutable<R> { 22 23 CtBlock<R> body; 24 25 List <CtTypeReference<?>> formalTypeParameters = new ArrayList <CtTypeReference<?>>(); 26 27 List <CtParameter<?>> parameters = new Vector <CtParameter<?>>(); 28 29 Set <CtTypeReference<? extends Throwable >> thrownTypes = new TreeSet <CtTypeReference<? extends Throwable >>(); 30 31 public CtExecutableImpl() { 32 super(); 33 } 34 35 public CtBlock<R> getBody() { 36 return body; 37 } 38 39 public List <CtTypeReference<?>> getFormalTypeParameters() { 40 return formalTypeParameters; 41 } 42 43 public List <CtParameter<?>> getParameters() { 44 return parameters; 45 } 46 47 public Set <CtTypeReference<? extends Throwable >> getThrownTypes() { 48 return thrownTypes; 49 } 50 51 public void setBody(CtBlock<R> body) { 52 this.body = body; 53 } 54 55 public void setFormalTypeParameters( 56 List <CtTypeReference<?>> formalTypeParameters) { 57 this.formalTypeParameters = formalTypeParameters; 58 } 59 60 public void setParameters(List <CtParameter<?>> parameters) { 61 this.parameters = parameters; 62 } 63 64 public void setThrownTypes( 65 Set <CtTypeReference<? extends Throwable >> thrownTypes) { 66 this.thrownTypes = thrownTypes; 67 } 68 69 @Override 70 public CtExecutableReference<R> getReference() { 71 return getFactory().Executable().createReference(this); 72 } 73 74 String getSignature() { 75 return getSimpleName().toString() + "(" + getParameters().toString() 76 + ")"; 77 } 78 79 } 80 | Popular Tags |