View Javadoc

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