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 LoggerModel extends Model { 024 025 private static final long serialVersionUID = 5326913660697375316L; 026 027 String name; 028 String level; 029 String additivity; 030 031 @Override 032 protected LoggerModel makeNewInstance() { 033 return new LoggerModel(); 034 } 035 036 @Override 037 protected void mirror(Model that) { 038 LoggerModel actual = (LoggerModel) that; 039 super.mirror(actual); 040 this.name = actual.name; 041 this.level = actual.level; 042 this.additivity = actual.additivity; 043 } 044 045 public String getName() { 046 return name; 047 } 048 049 public void setName(String name) { 050 this.name = name; 051 } 052 053 public String getLevel() { 054 return level; 055 } 056 057 public void setLevel(String level) { 058 this.level = level; 059 } 060 061 public String getAdditivity() { 062 return additivity; 063 } 064 065 public void setAdditivity(String additivity) { 066 this.additivity = additivity; 067 } 068 069 @Override 070 public String toString() { 071 return this.getClass().getSimpleName() + " name=" + name + "]"; 072 } 073 074 @Override 075 public int hashCode() { 076 final int prime = 31; 077 int result = super.hashCode(); 078 result = prime * result + Objects.hash(additivity, level, name); 079 return result; 080 } 081 082 @Override 083 public boolean equals(Object obj) { 084 if (this == obj) 085 return true; 086 if (!super.equals(obj)) 087 return false; 088 if (getClass() != obj.getClass()) 089 return false; 090 LoggerModel other = (LoggerModel) obj; 091 return Objects.equals(additivity, other.additivity) && Objects.equals(level, other.level) 092 && Objects.equals(name, other.name); 093 } 094 095 096}