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.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     * Notify that the audit is about to start.
040     * @param event the event details
041     */
042    void auditStarted(AuditEvent event);
043
044    /**
045     * Notify that the audit is finished.
046     * @param event the event details
047     */
048    void auditFinished(AuditEvent event);
049
050    /**
051     * Notify that audit is about to start on a specific file.
052     * @param event the event details
053     */
054    void fileStarted(AuditEvent event);
055
056    /**
057     * Notify that audit is finished on a specific file.
058     * @param event the event details
059     */
060    void fileFinished(AuditEvent event);
061
062    /**
063     * Notify that an audit error was discovered on a specific file.
064     * @param event the event details
065     */
066    void addError(AuditEvent event);
067
068    /**
069     * Notify that an exception happened while performing audit.
070     * @param event the event details
071     * @param throwable details of the exception
072     */
073    void addException(AuditEvent event, Throwable throwable);
074}