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