1
2
3
4
5
6
7
8
9
10 package chapter10.implicit;
11
12 import org.xml.sax.Attributes;
13
14 import ch.qos.logback.core.joran.action.ImplicitAction;
15 import ch.qos.logback.core.joran.spi.InterpretationContext;
16 import ch.qos.logback.core.joran.spi.Pattern;
17
18
19
20
21
22
23
24
25 public class PrintMeImplicitAction extends ImplicitAction {
26
27 public boolean isApplicable(Pattern pattern, Attributes attributes,
28 InterpretationContext ec) {
29 String printmeStr = attributes.getValue("printme");
30
31 return Boolean.valueOf(printmeStr).booleanValue();
32 }
33
34 public void begin(InterpretationContext ec, String name, Attributes attributes) {
35 System.out.println("Element [" + name + "] asked to be printed.");
36 }
37
38 public void end(InterpretationContext ec, String name) {
39 }
40 }