public abstract class AbstractProcessor<E extends CtElement> extends java.lang.Object implements Processor<E>
Constructor and Description |
---|
AbstractProcessor()
Empty constructor only for all processors (invoked by Spoon).
|
Modifier and Type | Method and Description |
---|---|
protected void |
addProcessedElementType(java.lang.Class<? extends CtElement> elementType)
Adds a processed element type.
|
protected void |
clearProcessedElementType()
Clears the processed element types.
|
Environment |
getEnvironment()
Gets the environment of this processor.
|
Factory |
getFactory()
Gets the factory of this object.
|
java.util.Set<java.lang.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)
Helper method to initialize the properties of a given processor.
|
void |
interrupt()
Interrupts the processing of this processor but changes on your AST are kept
and the invocation of this method doesn't interrupt the processing of all
processors specified in the
ProcessingManager . |
boolean |
isToBeProcessed(E candidate)
Tells if this element is to be processed (returns
true in
the default implementation). |
ProcessorProperties |
loadProperties()
Helper method to load the properties of the given processor (uses
Environment.getProcessorProperties(String) ). |
void |
process()
The manual meta-model processing cannot be overridden (use
AbstractManualProcessor ) to do so. |
void |
processingDone()
This method is upcalled by the
ProcessingManager when this
processor has finished a full processing round on the program's model. |
protected void |
removeProcessedElementType(java.lang.Class<? extends CtElement> elementType)
Removes a processed element type.
|
void |
setFactory(Factory factory)
Sets the factory object.
|
public AbstractProcessor()
protected void addProcessedElementType(java.lang.Class<? extends CtElement> elementType)
protected void clearProcessedElementType()
public Environment getEnvironment()
Processor
getEnvironment
in interface Processor<E extends CtElement>
public Factory getFactory()
FactoryAccessor
getFactory
in interface FactoryAccessor
public java.util.Set<java.lang.Class<? extends CtElement>> getProcessedElementTypes()
Processor
getProcessedElementTypes
in interface Processor<E extends CtElement>
public ProcessorProperties loadProperties()
Environment.getProcessorProperties(String)
).public TraversalStrategy getTraversalStrategy()
Processor
TraversalStrategy.POST_ORDER
). Programmers should override this
method to return another strategy if needed.getTraversalStrategy
in interface Processor<E extends CtElement>
public void init()
Processor
public boolean isToBeProcessed(E candidate)
Processor
true
in
the default implementation).isToBeProcessed
in interface Processor<E extends CtElement>
candidate
- the candidateProcessor.process(CtElement)
public void initProperties(ProcessorProperties properties)
initProperties
in interface Processor<E extends CtElement>
Environment.getProcessorProperties(String)
public final void process()
AbstractManualProcessor
) to do so.public void processingDone()
Processor
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.processingDone
in interface Processor<E extends CtElement>
protected void removeProcessedElementType(java.lang.Class<? extends CtElement> elementType)
public void setFactory(Factory factory)
FactoryAccessor
setFactory
in interface FactoryAccessor
public void interrupt()
Processor
ProcessingManager
.Copyright © 2007–2021 Inria. All rights reserved.