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.pattern.parser;
15  
16  import java.util.List;
17  
18  public class SimpleKeywordNode extends FormattingNode {
19  
20      List<String> optionList;
21  
22      SimpleKeywordNode(Object value) {
23          super(Node.SIMPLE_KEYWORD, value);
24      }
25  
26      protected SimpleKeywordNode(int type, Object value) {
27          super(type, value);
28      }
29  
30      public List<String> getOptions() {
31          return optionList;
32      }
33  
34      public void setOptions(List<String> optionList) {
35          this.optionList = optionList;
36      }
37  
38      public boolean equals(Object o) {
39          if (!super.equals(o)) {
40              return false;
41          }
42  
43          if (!(o instanceof SimpleKeywordNode)) {
44              return false;
45          }
46          SimpleKeywordNode r = (SimpleKeywordNode) o;
47  
48          return (optionList != null ? optionList.equals(r.optionList) : r.optionList == null);
49      }
50  
51      @Override
52      public int hashCode() {
53          return super.hashCode();
54      }
55  
56      public String toString() {
57          StringBuilder buf = new StringBuilder();
58          if (optionList == null) {
59              buf.append("KeyWord(" + value + "," + formatInfo + ")");
60          } else {
61              buf.append("KeyWord(" + value + ", " + formatInfo + "," + optionList + ")");
62          }
63          buf.append(printNext());
64          return buf.toString();
65      }
66  }