Package spoon.reflect.visitor
Class ForceImportProcessor
- All Implemented Interfaces:
FactoryAccessor
,Processor<CtElement>
Marks all types references as implicit so all types will get imported.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected LexicalScopeScanner
creates the scanner that will be used to visit the modelprotected CtScannerListener
protected static <T extends CtElement>
TgetParentIfType(CtElement element, Class<T> type)
protected LexicalScope
extract the required information from the scanner to take a decisionprotected void
handleTargetedExpression(CtTargetedExpression<?,?> targetedExpression, LexicalScope nameScope)
what do we do a target expression (print target or not) ?protected void
handleTypeReference(CtTypeReference<?> reference, LexicalScope nameScope, CtRole role)
what do we do a type reference?protected void
onEnter(LexicalScope context, CtRole role, CtElement element)
void
A callback method called by the meta-model scanner to perform a dedicated job on the currently scanned element.protected static void
process(CtScanner scanner, CtCompilationUnit cu)
Methods inherited from class spoon.processing.AbstractProcessor
addProcessedElementType, clearProcessedElementType, getEnvironment, getFactory, getProcessedElementTypes, getTraversalStrategy, init, initProperties, interrupt, isToBeProcessed, loadProperties, process, processingDone, removeProcessedElementType, setFactory
-
Field Details
-
scanner
-
IGNORED_ROLES_WHEN_IMPLICIT
-
-
Constructor Details
-
ForceImportProcessor
public ForceImportProcessor()
-
-
Method Details
-
createScanner
creates the scanner that will be used to visit the model -
getScannerContextInformation
extract the required information from the scanner to take a decision -
handleTypeReference
protected void handleTypeReference(CtTypeReference<?> reference, LexicalScope nameScope, CtRole role)what do we do a type reference? -
handleTargetedExpression
protected void handleTargetedExpression(CtTargetedExpression<?,?> targetedExpression, LexicalScope nameScope)what do we do a target expression (print target or not) ? -
process
Description copied from interface:Processor
A callback method called by the meta-model scanner to perform a dedicated job on the currently scanned element. The way Spoon calls this method depends on the processed element types (Processor.getProcessedElementTypes()
), the traversal strategy (Processor.getTraversalStrategy()
), and the used processing manager (Environment.getManager()
. Also, this method is called only if the methodProcessor.isToBeProcessed(CtElement)
returns true for a given scanned element. In order to manually scan the meta-model, one can define theProcessor.process()
method instead.- Parameters:
el
- the element that is currently being scanned
-
process
-
createScannerListener
-
onEnter
-
getParentIfType
- Returns:
- parent of `element`, but only if it's type is `type`
-