001/*
002 * Logback: the reliable, generic, fast and flexible logging framework.
003 * Copyright (C) 1999-2026, 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 v2.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 */
014
015package ch.qos.logback.core.model;
016
017import java.util.Objects;
018
019public class PropertyModel extends NamedModel {
020
021    private static final long serialVersionUID = 1494176979175092052L;
022    
023    String value;
024    String scopeStr;
025
026    String file;
027    String resource;
028
029    @Override
030    protected PropertyModel makeNewInstance() {
031        return new PropertyModel();
032    }
033    
034    @Override
035    protected void mirror(Model that) {
036        PropertyModel actual = (PropertyModel) that;
037        super.mirror(actual);
038        this.value = actual.value;
039        this.scopeStr = actual.scopeStr;
040        this.file = actual.file;
041        this.resource = actual.resource;
042        
043    }
044    
045    public String getValue() {
046        return value;
047    }
048
049    public void setValue(String value) {
050        this.value = value;
051    }
052
053    public String getScopeStr() {
054        return scopeStr;
055    }
056
057    public void setScopeStr(String scopeStr) {
058        this.scopeStr = scopeStr;
059    }
060
061    public String getFile() {
062        return file;
063    }
064
065    public void setFile(String file) {
066        this.file = file;
067    }
068
069    public String getResource() {
070        return resource;
071    }
072
073    public void setResource(String resource) {
074        this.resource = resource;
075    }
076
077    @Override
078    public int hashCode() {
079        final int prime = 31;
080        int result = super.hashCode();
081        result = prime * result + Objects.hash(file, resource, scopeStr, value);
082        return result;
083    }
084
085    @Override
086    public boolean equals(Object obj) {
087        if (this == obj)
088            return true;
089        if (!super.equals(obj))
090            return false;
091        if (getClass() != obj.getClass())
092            return false;
093        PropertyModel other = (PropertyModel) obj;
094        return Objects.equals(file, other.file) && Objects.equals(resource, other.resource)
095                && Objects.equals(scopeStr, other.scopeStr) && Objects.equals(value, other.value);
096    }
097
098    
099}