Search in sources :

Example 6 with QueueProcessingManager

use of spoon.support.QueueProcessingManager in project spoon by INRIA.

the class AnnotationTest method testAbstractAllAnnotationProcessor.

@Test
public void testAbstractAllAnnotationProcessor() throws Exception {
    Launcher spoon = new Launcher();
    spoon.addInputResource("./src/test/java/spoon/test/annotation/testclasses/AnnotationsAppliedOnAnyTypeInAClass.java");
    spoon.addInputResource("./src/test/java/spoon/test/annotation/testclasses/BasicAnnotation.java");
    spoon.addInputResource("./src/test/java/spoon/test/annotation/testclasses/TypeAnnotation.java");
    spoon.addInputResource("./src/test/java/spoon/test/annotation/testclasses/AnnotParamTypeEnum.java");
    spoon.addInputResource("./src/test/java/spoon/test/annotation/testclasses/InnerAnnot.java");
    spoon.addInputResource("./src/test/java/spoon/test/annotation/testclasses/Inception.java");
    spoon.addInputResource("./src/test/java/spoon/test/annotation/testclasses/TestAnnotation.java");
    spoon.addInputResource("./src/test/java/spoon/test/annotation/testclasses/AnnotArrayInnerClass.java");
    Factory factory = spoon.getFactory();
    spoon.buildModel();
    // create the processor
    final ProcessingManager p = new QueueProcessingManager(factory);
    final TypeAnnotationProcessor processor = new TypeAnnotationProcessor();
    p.addProcessor(processor);
    p.process(factory.Class().getAll());
    assertEquals(29, processor.elements.size());
}
Also used : QueueProcessingManager(spoon.support.QueueProcessingManager) ProcessingManager(spoon.processing.ProcessingManager) QueueProcessingManager(spoon.support.QueueProcessingManager) Launcher(spoon.Launcher) Factory(spoon.reflect.factory.Factory) Test(org.junit.Test)

Example 7 with QueueProcessingManager

use of spoon.support.QueueProcessingManager in project spoon by INRIA.

the class JDTBasedSpoonCompiler method process.

@Override
public void process(Collection<Processor<? extends CtElement>> processors) {
    // processing (consume all the processors)
    ProcessingManager processing = new QueueProcessingManager(factory);
    for (Processor<? extends CtElement> processorName : processors) {
        processing.addProcessor(processorName);
        factory.getEnvironment().debugMessage("Loaded processor " + processorName + ".");
    }
    processing.process(factory.Package().getRootPackage());
}
Also used : QueueProcessingManager(spoon.support.QueueProcessingManager) ProcessingManager(spoon.processing.ProcessingManager) QueueProcessingManager(spoon.support.QueueProcessingManager)

Aggregations

QueueProcessingManager (spoon.support.QueueProcessingManager)7 ProcessingManager (spoon.processing.ProcessingManager)5 Test (org.junit.Test)2 Launcher (spoon.Launcher)2 Factory (spoon.reflect.factory.Factory)2