Package spoon.processing
Class AbstractManualProcessor
- java.lang.Object
-
- spoon.processing.AbstractManualProcessor
-
- All Implemented Interfaces:
FactoryAccessor
,Processor<CtElement>
- Direct Known Subclasses:
SpoonTagger
public abstract class AbstractManualProcessor extends Object implements Processor<CtElement>
This class defines an abstract processor to be subclassed by the user for defining new manual processors. A manual processor should override the init method (called once) and scan the meta-model manually.
-
-
Constructor Summary
Constructors Constructor Description AbstractManualProcessor()
Empty constructor only for all processors (invoked by Spoon).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addProcessedElementType(Class<? extends CtElement> elementType)
Invalid method in this context.Environment
getEnvironment()
Gets the environment of this processor.Factory
getFactory()
Gets the factory of this object.Set<Class<? extends CtElement>>
getProcessedElementTypes()
Invalid method in this context.TraversalStrategy
getTraversalStrategy()
Invalid method in this context.void
init()
This method is called to initialize the processor before each processing round.void
initProperties(ProcessorProperties properties)
Initializes the properties defined by this processor by using the environment.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 theProcessingManager
.boolean
isPrivileged()
Invalid method in this context.boolean
isToBeProcessed(CtElement candidate)
Always returns false in this context.void
process(CtElement element)
Does nothing in this context.void
processingDone()
This method is called by theProcessingManager
when this processor has finished a full processing round on the program's model.void
setFactory(Factory factory)
Sets the factory object.
-
-
-
Method Detail
-
addProcessedElementType
protected void addProcessedElementType(Class<? extends CtElement> elementType)
Invalid method in this context.
-
getEnvironment
public Environment getEnvironment()
Description copied from interface:Processor
Gets the environment of this processor.- Specified by:
getEnvironment
in interfaceProcessor<CtElement>
-
getFactory
public final Factory getFactory()
Description copied from interface:FactoryAccessor
Gets the factory of this object.- Specified by:
getFactory
in interfaceFactoryAccessor
-
getProcessedElementTypes
public final Set<Class<? extends CtElement>> getProcessedElementTypes()
Invalid method in this context.- Specified by:
getProcessedElementTypes
in interfaceProcessor<CtElement>
-
getTraversalStrategy
public final TraversalStrategy getTraversalStrategy()
Invalid method in this context.- Specified by:
getTraversalStrategy
in interfaceProcessor<CtElement>
-
init
public void init()
Description copied from interface:Processor
This method is called to initialize the processor before each processing round. It is convenient to override this method rather than using a default constructor to initialize the processor, since the factory is not initialized at construction time. When overriding, do not forget to call super.init() first so that all the initializations performed by superclasses are also applied.
-
isPrivileged
public final boolean isPrivileged()
Invalid method in this context.
-
isToBeProcessed
public final boolean isToBeProcessed(CtElement candidate)
Always returns false in this context.- Specified by:
isToBeProcessed
in interfaceProcessor<CtElement>
- Parameters:
candidate
- the candidate- Returns:
- true if the candidate is to be processed by the
Processor.process(CtElement)
-
process
public final void process(CtElement element)
Does nothing in this context.
-
processingDone
public void processingDone()
Description copied from interface:Processor
This method is called by theProcessingManager
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 (seeProcessingManager.addProcessor(Class)
). Does nothing by default.- Specified by:
processingDone
in interfaceProcessor<CtElement>
-
setFactory
public final void setFactory(Factory factory)
Description copied from interface:FactoryAccessor
Sets the factory object.- Specified by:
setFactory
in interfaceFactoryAccessor
-
initProperties
public final void initProperties(ProcessorProperties properties)
Description copied from interface:Processor
Initializes the properties defined by this processor by using the environment.- Specified by:
initProperties
in interfaceProcessor<CtElement>
- See Also:
Environment.getProcessorProperties(String)
-
interrupt
public void interrupt()
Description copied from interface:Processor
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 theProcessingManager
.
-
-