1 package spoon.jdiet; 2 3 import spoon.processing.AbstractProcessor; 4 import spoon.processing.ProcessingManager; 5 import spoon.reflect.declaration.CtClass; 6 7 /** 8 * This processor translates a Java source code into a J2ME compliant version. 9 * 10 * This processor does not perform any concrete translation. It just registers 11 * the other processor which will be perform the real job. This processor is 12 * just the entry point of the translation process. 13 * 14 * @author Lionel Seinturier <Lionel.Seinturier@lifl.fr> 15 */ 16 public class JDietProcessor extends AbstractProcessor<CtClass> { 17 18 public boolean isToBeProcessed( CtClass ct ) { 19 return first; 20 } 21 22 private boolean first = true; 23 24 public void process( CtClass ct ) { 25 ProcessingManager pm = getManager(); 26 pm.addProcessor( new ClassProcessor() ); 27 pm.addProcessor( new ExpressionProcessor() ); 28 pm.addProcessor( new InvocationProcessor() ); 29 pm.addProcessor( new MethodProcessor() ); 30 pm.addProcessor( new NewClassProcessor() ); 31 pm.addProcessor( new VariableProcessor() ); 32 first = false; 33 } 34 35 } 36