View Javadoc

    1   package net.sourceforge.pmd.sourcetypehandlers;
    2
    3   import net.sourceforge.pmd.ast.ASTCompilationUnit;
    4   import net.sourceforge.pmd.dfa.DataFlowFacade;
    5   import net.sourceforge.pmd.symboltable.SymbolFacade;
    6   import net.sourceforge.pmd.typeresolution.TypeResolutionFacade;
    7
    8   /**
    9    * Implementation of VisitorsFactory for the Java AST. It uses anonymous classes
    10   * as adapters of the visitors to the VisitorStarter interface.
    11   *
    12   * @author pieter_van_raemdonck - Application Engineers NV/SA - www.ae.be
    13   */
    14  public abstract class JavaTypeHandler implements SourceTypeHandler {
    15
    16      public VisitorStarter getDataFlowFacade() {
    17          return new VisitorStarter() {
    18              public void start(Object rootNode) {
    19                  new DataFlowFacade().initializeWith((ASTCompilationUnit) rootNode);
    20              }
    21          };
    22      }
    23
    24      public VisitorStarter getSymbolFacade() {
    25          return new VisitorStarter() {
    26              public void start(Object rootNode) {
    27                  new SymbolFacade().initializeWith((ASTCompilationUnit) rootNode);
    28              }
    29          };
    30      }
    31
    32      public VisitorStarter getTypeResolutionFacade(final ClassLoader classLoader) {
    33          return new VisitorStarter() {
    34              public void start(Object rootNode) {
    35                  new TypeResolutionFacade().initializeWith(classLoader, (ASTCompilationUnit) rootNode);
    36              }
    37          };
    38      }
    39
    40
    41  }