1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.log4j.rule;
21
22 import org.apache.log4j.spi.LoggingEvent;
23
24 import java.beans.PropertyChangeListener;
25
26
27 /***
28 * A Rule evaluates to true of false given a LoggingEvent object, and can notify
29 * listeners when the underlying implementation of this Rule has it's
30 * criteria changed by using the standard PropertyChangeListener infrastructure.
31 *
32 * @author Paul Smith (psmith@apache.org)
33 * @author Scott Deboy (sdeboy@apache.org)
34 */
35 public interface Rule {
36 /***
37 * Returns true if this implementation of the rule accepts the LoggingEvent,
38 * or false if not.
39 *
40 * <p>What True/False means can be client-specific.
41 *
42 * @param e LoggingEvent this instance will evaluate
43 * @return true if this Rule instance accepts the event, otherwise false.
44 */
45 boolean evaluate(LoggingEvent e);
46
47 /***
48 * Adds a PropertyChangeListener to this instance, which is notified when
49 * underlying Rule information has changed.
50 * (there are no specific property name events).
51 * @param listener listener
52 */
53 void addPropertyChangeListener(PropertyChangeListener listener);
54
55 /***
56 * Removes a known PropertyChangeListener from this Rule.
57 * @param listener listener
58 */
59 void removePropertyChangeListener(PropertyChangeListener listener);
60 }