public interface Processor<E extends CtElement> extends FactoryAccessor
AbstractProcessor
, the
abstract default implementation of this interface.Modifier and Type | Method and Description |
---|---|
Environment |
getEnvironment()
Gets the environment of this processor.
|
Set<Class<? extends CtElement>> |
getProcessedElementTypes()
Gets all the element types than need to be processed.
|
TraversalStrategy |
getTraversalStrategy()
Gets the model's traversal strategy for this processor (default is
TraversalStrategy.POST_ORDER ). |
void |
init()
This method is upcalled to initialize the processor before each
processing round.
|
void |
initProperties(ProcessorProperties properties)
Initializes the properties defined by this processor by using the
environment.
|
boolean |
isToBeProcessed(E candidate)
Tells if this element is to be processed (returns
true in
the default implementation). |
void |
process()
A callback method upcalled by the manager so that this processor can
manually implement a processing job.
|
void |
process(E element)
A callback method upcalled by the meta-model scanner to perform a
dedicated job on the currently scanned element.
|
void |
processingDone()
This method is upcalled by the
ProcessingManager when this
processor has finished a full processing round on the program's model. |
getFactory, setFactory
TraversalStrategy getTraversalStrategy()
TraversalStrategy.POST_ORDER
). Programmers should override this
method to return another strategy if needed.Environment getEnvironment()
boolean isToBeProcessed(E candidate)
true
in
the default implementation).candidate
- the candidateprocess(CtElement)
void process(E element)
getProcessedElementTypes()
), the traversal strategy (
getTraversalStrategy()
), and the used processing manager (
Environment.getManager()
. Also, this method is upcalled only if
the method isToBeProcessed(CtElement)
returns true for a given
scanned element. In order to manually scan the meta-model, one can define
the process()
method instead.element
- the element that is currently being scannedvoid process()
process(CtElement)
, this method does not rely on a built-in
meta-model scanner and has to implement its own traversal strategy on the
meta-model, which is stored in the factory (
FactoryAccessor.getFactory()
). Note that if a processor implements
both process methods, this one is upcalled first. This method does
nothing in default implementations (
AbstractProcessor
).Set<Class<? extends CtElement>> getProcessedElementTypes()
void processingDone()
ProcessingManager
when this
processor has finished a full processing round on the program's model. It
is convenient to override this method to tune the application's strategy
of a set of processors, for instance by dynamically adding processors to
the processing manager when a processing round ends (see
ProcessingManager.addProcessor(Class)
). Does nothing by default.void init()
void initProperties(ProcessorProperties properties)
Copyright © 2007–2014 Inria. All rights reserved.