View Javadoc
1   /**
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2015, 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&uuml;lc&uuml;
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 The event to evaluate
40       * @return true if there is a match, false otherwise.
41       * @throws NullPointerException can be thrown in presence of null values
42       * @throws EvaluationException  may be thrown during faulty evaluation
43       */
44      boolean evaluate(E event) throws NullPointerException, EvaluationException;
45  
46      /**
47       * Evaluators are named entities.
48       * 
49       * @return The name of this evaluator.
50       */
51      String getName();
52  
53      /**
54       * Evaluators are named entities.
55       */
56      void setName(String name);
57  }