001/**
002 * Logback: the reliable, generic, fast and flexible logging framework.
003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved.
004 *
005 * This program and the accompanying materials are dual-licensed under
006 * either the terms of the Eclipse Public License v1.0 as published by
007 * the Eclipse Foundation
008 *
009 *   or (per the licensee's choosing)
010 *
011 * under the terms of the GNU Lesser General Public License version 2.1
012 * as published by the Free Software Foundation.
013 */
014package ch.qos.logback.core.spi;
015
016import java.util.Iterator;
017
018import ch.qos.logback.core.Appender;
019
020/**
021 * Interface for attaching appenders to objects.
022 * 
023 * @author Ceki Gülcü
024 */
025public interface AppenderAttachable<E> {
026    /**
027     * Add an appender.
028     */
029    void addAppender(Appender<E> newAppender);
030
031    /**
032     * Get an iterator for appenders contained in the parent object.
033     */
034    Iterator<Appender<E>> iteratorForAppenders();
035
036    /**
037     * Get an appender by name.
038     */
039    Appender<E> getAppender(String name);
040
041    /**
042     * Returns <code>true</code> if the specified appender is in list of
043     * attached, <code>false</code> otherwise.
044     */
045    boolean isAttached(Appender<E> appender);
046
047    /**
048     * Detach and processPriorToRemoval all previously added appenders.
049     */
050    void detachAndStopAllAppenders();
051
052    /**
053     * Detach the appender passed as parameter from the list of appenders.
054     */
055    boolean detachAppender(Appender<E> appender);
056
057    /**
058     * Detach the appender with the name passed as parameter from the list of
059     * appenders.
060     */
061    boolean detachAppender(String name);
062}