1 package spoon.template; 2 3 import spoon.reflect.code.CtBlock; 4 import spoon.reflect.declaration.CtClass; 5 import spoon.reflect.declaration.CtSimpleType; 6 7 16 public abstract class BlockTemplateParameter implements TemplateParameter<Void > { 17 18 21 public BlockTemplateParameter() { 22 } 23 24 public CtBlock<?> getSubstitution(CtSimpleType<?> targetType) { 25 CtClass<?> c; 26 c= targetType.getFactory().Template().get(this.getClass()); 27 if(c==null) { 28 c=targetType.getFactory().Class().get(this.getClass()); 29 } 30 if (this instanceof Template) { 31 return Substitution.substitute(targetType, (Template) this, c 32 .getMethod("block").getBody()); 33 } else { 34 return targetType.getFactory().Core().clone(c.getMethod("block") 35 .getBody()); 36 } 37 } 38 39 public Void S() { 40 return null; 41 } 42 43 46 public abstract void block() throws Throwable ; 47 } 48 | Popular Tags |