001/** 002 * Logback: the reliable, generic, fast and flexible logging framework. 003 * Copyright (C) 1999-2022, QOS.ch. All rights reserved. 004 * 005 * This program and the accompanying materials are dual-licensed under 006 * either the terms of the Eclipse Public License v1.0 as published by 007 * the Eclipse Foundation 008 * 009 * or (per the licensee's choosing) 010 * 011 * under the terms of the GNU Lesser General Public License version 2.1 012 * as published by the Free Software Foundation. 013 */ 014package ch.qos.logback.classic.model; 015 016import java.util.Objects; 017 018import ch.qos.logback.core.model.Model; 019import ch.qos.logback.core.model.processor.PhaseIndicator; 020import ch.qos.logback.core.model.processor.ProcessingPhase; 021 022@PhaseIndicator(phase = ProcessingPhase.SECOND) 023public class RootLoggerModel extends Model { 024 025 private static final long serialVersionUID = -2811453129653502831L; 026 String level; 027 028 @Override 029 protected RootLoggerModel makeNewInstance() { 030 return new RootLoggerModel(); 031 } 032 033 @Override 034 protected void mirror(Model that) { 035 RootLoggerModel actual = (RootLoggerModel) that; 036 super.mirror(actual); 037 this.level = actual.level; 038 } 039 040 041 public String getLevel() { 042 return level; 043 } 044 045 public void setLevel(String level) { 046 this.level = level; 047 } 048 049 @Override 050 public int hashCode() { 051 final int prime = 31; 052 int result = super.hashCode(); 053 result = prime * result + Objects.hash(level); 054 return result; 055 } 056 057 @Override 058 public boolean equals(Object obj) { 059 if (this == obj) 060 return true; 061 if (!super.equals(obj)) 062 return false; 063 if (getClass() != obj.getClass()) 064 return false; 065 RootLoggerModel other = (RootLoggerModel) obj; 066 return Objects.equals(level, other.level); 067 } 068 069 070}