1 /**
2 * Logback: the reliable, generic, fast and flexible logging framework.
3 * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
4 *
5 * This program and the accompanying materials are dual-licensed under
6 * either the terms of the Eclipse Public License v1.0 as published by
7 * the Eclipse Foundation
8 *
9 * or (per the licensee's choosing)
10 *
11 * under the terms of the GNU Lesser General Public License version 2.1
12 * as published by the Free Software Foundation.
13 */
14 package ch.qos.logback.core.boolex;
15
16 import ch.qos.logback.core.spi.ContextAware;
17 import ch.qos.logback.core.spi.LifeCycle;
18
19 /**
20 * Evaluates whether a given an event matches user-specified criteria.
21 *
22 * <p>
23 * Implementations are free to evaluate the event as they see fit. In
24 * particular, the evaluation results <em>may</em> depend on previous events.
25 *
26 * @author Ceki Gülcü
27 */
28
29 public interface EventEvaluator<E> extends ContextAware, LifeCycle {
30
31 /**
32 * Evaluates whether the event passed as parameter matches some user-specified
33 * criteria.
34 *
35 * <p>
36 * The <code>Evaluator</code> is free to evaluate the event as it pleases. In
37 * particular, the evaluation results <em>may</em> depend on previous events.
38 *
39 * @param event
40 * The event to evaluate
41 * @return true if there is a match, false otherwise.
42 * @throws NullPointerException
43 * can be thrown in presence of null values
44 * @throws EvaluationException
45 * may be thrown during faulty evaluation
46 */
47 boolean evaluate(E event) throws NullPointerException, EvaluationException;
48
49 /**
50 * Evaluators are named entities.
51 *
52 * @return The name of this evaluator.
53 */
54 public String getName();
55
56 /**
57 * Evaluators are named entities.
58 */
59 public void setName(String name);
60 }