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.boolex; 015 016import ch.qos.logback.core.spi.ContextAware; 017import ch.qos.logback.core.spi.LifeCycle; 018 019/** 020 * Evaluates whether a given an event matches user-specified criteria. 021 * 022 * <p> 023 * Implementations are free to evaluate the event as they see fit. In 024 * particular, the evaluation results <em>may</em> depend on previous events. 025 * 026 * @author Ceki Gülcü 027 */ 028 029public interface EventEvaluator<E> extends ContextAware, LifeCycle { 030 031 /** 032 * Evaluates whether the event passed as parameter matches some user-specified 033 * criteria. 034 * 035 * <p> 036 * The <code>Evaluator</code> is free to evaluate the event as it pleases. In 037 * particular, the evaluation results <em>may</em> depend on previous events. 038 * 039 * @param event The event to evaluate 040 * @return true if there is a match, false otherwise. 041 * @throws NullPointerException can be thrown in presence of null values 042 * @throws EvaluationException may be thrown during faulty evaluation 043 */ 044 boolean evaluate(E event) throws NullPointerException, EvaluationException; 045 046 /** 047 * Evaluators are named entities. 048 * 049 * @return The name of this evaluator. 050 */ 051 String getName(); 052 053 /** 054 * Evaluators are named entities. 055 */ 056 void setName(String name); 057}