KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > spoon > processing > ProcessingManager


1 package spoon.processing;
2
3 import java.util.Collection JavaDoc;
4
5 import spoon.reflect.Factory;
6 import spoon.reflect.declaration.CtElement;
7
8 /**
9  * The processing manager defines the API to process a program model of a given
10  * {@link spoon.reflect.Factory} with a set of processors. The program model has
11  * been previously built using a {@link spoon.processing.Builder} - see
12  * {@link spoon.processing.Builder#build(Factory)}. To use, add processors to
13  * the manager, and then call the {@code process} method. The processors will be
14  * removed from the manager once applied. Also, the method
15  * {@link spoon.processing.Processor#processingDone()} is upcalled.
16  *
17  * @see spoon.processing.Environment#getManager()
18  */

19 public interface ProcessingManager extends FactoryAccessor {
20     /**
21      * Adds a processor by instantiating its type (a class that must define an
22      * empty constructor).
23      *
24      * @see #getProcessors().
25      */

26     public void addProcessor(Class JavaDoc<? extends Processor> type);
27
28     /**
29      * Adds a processor.
30      *
31      * @see #getProcessors().
32      */

33     public boolean addProcessor(Processor<?> p);
34
35     /**
36      * Adds a processor by instantiating its type (a class that must define an
37      * empty constructor and implement {@link Processor}).
38      *
39      * @param qualifiedName
40      * the qualified name of the processor's type
41      * @see #getProcessors().
42      */

43     public void addProcessor(String JavaDoc qualifiedName);
44
45     /**
46      * Returns {@code true} if the manager will apply a given processor type
47      * when invoking one of the {@code process} methods. To be applied
48      * processors are the ones that have been added with one of the
49      * {@code addProcessor} methods.
50      *
51      * @see #process(Collection)
52      * @see #process()
53      */

54     public boolean isToBeApplied(Class JavaDoc<? extends Processor> type);
55
56     /**
57      * Gets the processors that have been added to the manager and that will be
58      * applied when invoking one of the {@code process} methods).
59      *
60      * @see #process(Collection)
61      * @see #process()
62      */

63     public Collection JavaDoc<Processor> getProcessors();
64
65     /**
66      * Recursively processes a collection of {@link CtElement}s with this
67      * manager. All the processors added to this manager (see
68      * {@link #getProcessors()}) should be applied before the method returns
69      * (blocking implementation) or before another call to a
70      * <code>process</code> method (non-blocking implementation). Processors
71      * that have been applied are removed from the manager and
72      * {@link #getProcessors()} does not contain them anymore.
73      */

74     public void process(Collection JavaDoc<? extends CtElement> elements);
75
76     /**
77      * Recursively processes a {@link CtElement} with this manager. All the
78      * processors added to this manager (see {@link #getProcessors()}) should
79      * be applied before the method returns (blocking implementation) or before
80      * another call to a <code>process</code> method (non-blocking
81      * implementation). Processors that have been applied are removed from the
82      * manager and {@link #getProcessors()} does not contain them anymore.
83      */

84     public void process(CtElement element);
85
86     /**
87      * Processes the entire factory's model with this manager. All the
88      * processors added to this manager (see {@link #getProcessors()}) should
89      * be applied before the method returns (blocking implementation) or before
90      * another call to a <code>process</code> method (non-blocking
91      * implementation). Processors that have been applied are removed from the
92      * manager and {@link #getProcessors()} does not contain them anymore.
93      */

94     public void process();
95
96     /**
97      * Gets the processor which is currently achieving the processing task if
98      * any.
99      */

100     public Processor<?> getCurrentProcessor();
101 }
102
Popular Tags