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.core.model; 015 016import java.util.Objects; 017 018public class InsertFromJNDIModel extends Model { 019 020 private static final long serialVersionUID = -7803377963650426197L; 021 022 public static final String ENV_ENTRY_NAME_ATTR = "env-entry-name"; 023 public static final String AS_ATTR = "as"; 024 025 String as; 026 String envEntryName; 027 String scopeStr; 028 029 @Override 030 protected InsertFromJNDIModel makeNewInstance() { 031 return new InsertFromJNDIModel(); 032 } 033 034 @Override 035 protected void mirror(Model that) { 036 InsertFromJNDIModel actual = (InsertFromJNDIModel) that; 037 super.mirror(actual); 038 this.as = actual.as; 039 this.envEntryName = actual.envEntryName; 040 this.scopeStr = actual.scopeStr; 041 } 042 043 044 public String getScopeStr() { 045 return scopeStr; 046 } 047 048 public void setScopeStr(String scopeStr) { 049 this.scopeStr = scopeStr; 050 } 051 052 public String getAs() { 053 return as; 054 } 055 056 public void setAs(String as) { 057 this.as = as; 058 } 059 060 public String getEnvEntryName() { 061 return envEntryName; 062 } 063 064 public void setEnvEntryName(String envEntryName) { 065 this.envEntryName = envEntryName; 066 } 067 068 @Override 069 public int hashCode() { 070 final int prime = 31; 071 int result = super.hashCode(); 072 result = prime * result + Objects.hash(as, envEntryName, scopeStr); 073 return result; 074 } 075 076 @Override 077 public boolean equals(Object obj) { 078 if (this == obj) 079 return true; 080 if (!super.equals(obj)) 081 return false; 082 if (getClass() != obj.getClass()) 083 return false; 084 InsertFromJNDIModel other = (InsertFromJNDIModel) obj; 085 return Objects.equals(as, other.as) && Objects.equals(envEntryName, other.envEntryName) 086 && Objects.equals(scopeStr, other.scopeStr); 087 } 088 089}