001//////////////////////////////////////////////////////////////////////////////// 002// checkstyle: Checks Java source code for adherence to a set of rules. 003// Copyright (C) 2001-2017 the original author or authors. 004// 005// This library is free software; you can redistribute it and/or 006// modify it under the terms of the GNU Lesser General Public 007// License as published by the Free Software Foundation; either 008// version 2.1 of the License, or (at your option) any later version. 009// 010// This library is distributed in the hope that it will be useful, 011// but WITHOUT ANY WARRANTY; without even the implied warranty of 012// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013// Lesser General Public License for more details. 014// 015// You should have received a copy of the GNU Lesser General Public 016// License along with this library; if not, write to the Free Software 017// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 018//////////////////////////////////////////////////////////////////////////////// 019 020package com.puppycrawl.tools.checkstyle.api; 021 022import java.io.File; 023import java.util.List; 024 025/** 026 * The first module that is run as part of Checkstyle and controls its entire 027 * behavior and children. 028 * @author Richard Veach 029 */ 030public interface RootModule extends Configurable { 031 /** Cleans up the object. **/ 032 void destroy(); 033 034 /** 035 * Processes a set of files. 036 * Once this is done, it is highly recommended to call for 037 * the destroy method to close and remove the listeners. 038 * @param files the list of files to be audited. 039 * @return the total number of errors found 040 * @throws CheckstyleException if error condition within Checkstyle occurs 041 * @see #destroy() 042 */ 043 int process(List<File> files) throws CheckstyleException; 044 045 /** 046 * Add the listener that will be used to receive events from the audit. 047 * @param listener the nosy thing 048 */ 049 void addListener(AuditListener listener); 050 051 /** 052 * Sets the classloader used to load Checkstyle core and custom module 053 * classes when the module tree is being built up. 054 * If no custom ModuleFactory is being set for the root module then 055 * this module classloader must be specified. 056 * @param moduleClassLoader the classloader used to load module classes 057 */ 058 void setModuleClassLoader(ClassLoader moduleClassLoader); 059}