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 RootLoggerModel extends Model {
24  
25      private static final long serialVersionUID = -2811453129653502831L;
26      String level;
27  
28      @Override
29      protected RootLoggerModel makeNewInstance() {
30          return new RootLoggerModel();
31      }
32      
33      @Override
34      protected void mirror(Model that) {
35          RootLoggerModel actual = (RootLoggerModel) that;
36          super.mirror(actual);
37          this.level = actual.level;
38      }
39      
40      
41      public String getLevel() {
42          return level;
43      }
44  
45      public void setLevel(String level) {
46          this.level = level;
47      }
48  
49      @Override
50      public int hashCode() {
51          final int prime = 31;
52          int result = super.hashCode();
53          result = prime * result + Objects.hash(level);
54          return result;
55      }
56  
57      @Override
58      public boolean equals(Object obj) {
59          if (this == obj)
60              return true;
61          if (!super.equals(obj))
62              return false;
63          if (getClass() != obj.getClass())
64              return false;
65          RootLoggerModel other = (RootLoggerModel) obj;
66          return Objects.equals(level, other.level);
67      }
68      
69      
70  }