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   
7   /***
8    * Implementation of VisitorsFactory for the Java AST. It uses anonymous classes
9    * as adapters of the visitors to the VisitorStarter interface.
10   *
11   * @author pieter_van_raemdonck - Application Engineers NV/SA - www.ae.be
12   */
13  public abstract class JavaTypeHandler implements SourceTypeHandler {
14      private DataFlowFacade dataFlowFacade = new DataFlowFacade();
15      private SymbolFacade stb = new SymbolFacade();
16  
17  
18      public VisitorStarter getDataFlowFacade() {
19          return new VisitorStarter() {
20              public void start(Object rootNode) {
21                  dataFlowFacade.initializeWith((ASTCompilationUnit) rootNode);
22              }
23          };
24      }
25  
26      public VisitorStarter getSymbolFacade() {
27          return new VisitorStarter() {
28              public void start(Object rootNode) {
29                  stb.initializeWith((ASTCompilationUnit) rootNode);
30              }
31          };
32      }
33  }