View Javadoc
1   /**
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2022, 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.model;
15  
16  import java.util.Objects;
17  
18  /**
19   * Abstract representation of configuration elements
20   * 
21   * @author Ceki Gülcü
22   * @since 1.3.0
23   */
24  public class ComponentModel extends Model {
25  
26      private static final long serialVersionUID = -7117814935763453139L;
27  
28      String className;
29  
30      @Override
31      protected ComponentModel makeNewInstance() {
32          return new ComponentModel();
33      }
34      
35      @Override
36      protected void mirror(Model that) {
37          ComponentModel actual = (ComponentModel) that;
38          super.mirror(actual);
39          this.className = actual.className;
40      }
41      
42      
43      public String getClassName() {
44          return className;
45      }
46  
47      public void setClassName(String className) {
48          this.className = className;
49      }
50  
51      @Override
52      public String toString() {
53          return this.getClass().getSimpleName() + " [tag=" + tag + ", className=" + className + ", bodyText=" + bodyText
54                  + "]";
55      }
56  
57      @Override
58      public int hashCode() {
59          final int prime = 31;
60          int result = super.hashCode();
61          result = prime * result + Objects.hash(className);
62          return result;
63      }
64  
65      @Override
66      public boolean equals(Object obj) {
67          if (this == obj)
68              return true;
69          if (!super.equals(obj))
70              return false;
71          if (getClass() != obj.getClass())
72              return false;
73          ComponentModel other = (ComponentModel) obj;
74          return Objects.equals(className, other.className);
75      }
76  
77  }