1 package spoon; 2 3 import java.io.File ; 4 import java.util.ArrayList ; 5 import java.util.List ; 6 7 import org.apache.tools.ant.BuildException; 8 9 13 public class LtSpoonTask extends SpoonTask { 14 15 String sourcepath; 16 17 List <ProcessorType> ltprocessorTypes = new ArrayList <ProcessorType>(); 18 19 22 public LtSpoonTask() { 23 setClassname(LtLauncher.class.getName()); 24 } 25 26 30 public void addLtProcessor(ProcessorType processorType) { 31 this.ltprocessorTypes.add(processorType); 32 } 33 34 37 @Override 38 public void execute() throws BuildException { 39 if (classname == null) { 40 throw new BuildException("classname is mandatory"); 41 } 42 43 if (sourcepath != null) { 44 createArg().setValue("-i"); 45 createArg().setValue(sourcepath); 46 } 47 48 if (ltprocessorTypes != null && ltprocessorTypes.size() > 0) { 50 createArg().setValue("-l"); 51 String processor = ""; 52 for (ProcessorType t : ltprocessorTypes) 53 processor += t.getType() + File.pathSeparator; 54 createArg().setValue(processor); 55 } 56 57 super.execute(); 58 } 59 60 63 public void setSourcepath(String sourcepath) { 64 this.sourcepath = sourcepath; 65 } 66 67 } 68 | Popular Tags |