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 ch.qos.logback.core.pattern.FormatInfo;
17  
18  public class FormattingNode extends Node {
19  
20      FormatInfo formatInfo;
21  
22      FormattingNode(int type) {
23          super(type);
24      }
25  
26      FormattingNode(int type, Object value) {
27          super(type, value);
28      }
29  
30      public FormatInfo getFormatInfo() {
31          return formatInfo;
32      }
33  
34      public void setFormatInfo(FormatInfo formatInfo) {
35          this.formatInfo = formatInfo;
36      }
37  
38      public boolean equals(Object o) {
39          if (!super.equals(o)) {
40              return false;
41          }
42  
43          if (!(o instanceof FormattingNode)) {
44              return false;
45          }
46          FormattingNode r = (FormattingNode) o;
47  
48          return (formatInfo != null ? formatInfo.equals(r.formatInfo) : r.formatInfo == null);
49      }
50  
51      @Override
52      public int hashCode() {
53          int result = super.hashCode();
54          result = 31 * result + (formatInfo != null ? formatInfo.hashCode() : 0);
55          return result;
56      }
57  }