Class ForceImportProcessor

java.lang.Object
spoon.processing.AbstractProcessor<CtElement>
spoon.reflect.visitor.ForceImportProcessor
All Implemented Interfaces:
FactoryAccessor, Processor<CtElement>

public class ForceImportProcessor extends AbstractProcessor<CtElement>
Marks all types references as implicit so all types will get imported.
  • Field Details

  • Constructor Details

    • ForceImportProcessor

      public ForceImportProcessor()
  • Method Details

    • createScanner

      protected LexicalScopeScanner createScanner()
      creates the scanner that will be used to visit the model
    • getScannerContextInformation

      protected LexicalScope 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

      public void process(CtElement el)
      Description copied from interface: Processor
      A callback method upcalled by the meta-model scanner to perform a dedicated job on the currently scanned element. The way Spoon upcalls 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 upcalled only if the method Processor.isToBeProcessed(CtElement) returns true for a given scanned element. In order to manually scan the meta-model, one can define the Processor.process() method instead.
      Parameters:
      el - the element that is currently being scanned
    • process

      protected static void process(CtScanner scanner, CtCompilationUnit cu)
    • createScannerListener

      protected CtScannerListener createScannerListener()
    • onEnter

      protected void onEnter(LexicalScope context, CtRole role, CtElement element)
    • getParentIfType

      protected static <T extends CtElement> T getParentIfType(CtElement element, Class<T> type)
      Returns:
      parent of `element`, but only if it's type is `type`