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.classic.model;
15  
16  import java.util.Objects;
17  
18  import ch.qos.logback.core.model.Model;
19  import ch.qos.logback.core.model.processor.PhaseIndicator;
20  import ch.qos.logback.core.model.processor.ProcessingPhase;
21  
22  @PhaseIndicator(phase = ProcessingPhase.SECOND)
23  public class LoggerModel extends Model {
24  
25      private static final long serialVersionUID = 5326913660697375316L;
26  
27      String name;
28      String level;
29      String additivity;
30  
31      @Override
32      protected LoggerModel makeNewInstance() {
33          return new LoggerModel();
34      }
35      
36      @Override
37      protected void mirror(Model that) {
38          LoggerModel actual = (LoggerModel) that;
39          super.mirror(actual);
40          this.name = actual.name;
41          this.level = actual.level;
42          this.additivity = actual.additivity;
43      }
44      
45      public String getName() {
46          return name;
47      }
48  
49      public void setName(String name) {
50          this.name = name;
51      }
52  
53      public String getLevel() {
54          return level;
55      }
56  
57      public void setLevel(String level) {
58          this.level = level;
59      }
60  
61      public String getAdditivity() {
62          return additivity;
63      }
64  
65      public void setAdditivity(String additivity) {
66          this.additivity = additivity;
67      }
68  
69      @Override
70      public String toString() {
71          return this.getClass().getSimpleName() + " name=" + name + "]";
72      }
73  
74      @Override
75      public int hashCode() {
76          final int prime = 31;
77          int result = super.hashCode();
78          result = prime * result + Objects.hash(additivity, level, name);
79          return result;
80      }
81  
82      @Override
83      public boolean equals(Object obj) {
84          if (this == obj)
85              return true;
86          if (!super.equals(obj))
87              return false;
88          if (getClass() != obj.getClass())
89              return false;
90          LoggerModel other = (LoggerModel) obj;
91          return Objects.equals(additivity, other.additivity) && Objects.equals(level, other.level)
92                  && Objects.equals(name, other.name);
93      }
94      
95      
96  }