001//////////////////////////////////////////////////////////////////////////////// 002// checkstyle: Checks Java source code for adherence to a set of rules. 003// Copyright (C) 2001-2018 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.util.EventListener; 023 024/** 025 * Listener in charge of receiving events from the Checker. 026 * Typical events sequence is: 027 * <pre> 028 * auditStarted 029 * (fileStarted 030 * (addError)* 031 * fileFinished )* 032 * auditFinished 033 * </pre> 034 * @author <a href="mailto:stephane.bailliez@wanadoo.fr">Stephane Bailliez</a> 035 */ 036public interface AuditListener 037 extends EventListener { 038 039 /** 040 * Notify that the audit is about to start. 041 * @param event the event details 042 */ 043 void auditStarted(AuditEvent event); 044 045 /** 046 * Notify that the audit is finished. 047 * @param event the event details 048 */ 049 void auditFinished(AuditEvent event); 050 051 /** 052 * Notify that audit is about to start on a specific file. 053 * @param event the event details 054 */ 055 void fileStarted(AuditEvent event); 056 057 /** 058 * Notify that audit is finished on a specific file. 059 * @param event the event details 060 */ 061 void fileFinished(AuditEvent event); 062 063 /** 064 * Notify that an audit error was discovered on a specific file. 065 * @param event the event details 066 */ 067 void addError(AuditEvent event); 068 069 /** 070 * Notify that an exception happened while performing audit. 071 * @param event the event details 072 * @param throwable details of the exception 073 */ 074 void addException(AuditEvent event, Throwable throwable); 075 076}