blob: c28700d324cd47ebe22cf5f85054f4d214945986 [file] [log] [blame]
/********************************************************************************
* Copyright (c) 2015-2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
********************************************************************************/
package org.eclipse.mdm.preferences.entity;
import java.util.Objects;
import javax.xml.bind.annotation.XmlRootElement;
import com.google.common.base.MoreObjects;
/**
*
* @author Johannes Stamm, Peak Solution GmbH
*
*/
@XmlRootElement(name = "preference")
public class PreferenceMessage {
public enum Scope {
SYSTEM, SOURCE, USER;
}
private Scope scope;
private String source;
private String user;
private String key;
private String value;
private Long id;
public Scope getScope() {
return scope;
}
public void setScope(Scope scope) {
this.scope = scope;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final PreferenceMessage other = (PreferenceMessage) obj;
return Objects.equals(this.id, other.id) && Objects.equals(this.scope, other.scope)
&& Objects.equals(this.source, other.source) && Objects.equals(this.user, other.user)
&& Objects.equals(this.key, other.key) && Objects.equals(this.value, other.value);
}
@Override
public int hashCode() {
return Objects.hash(id, scope, source, user, key, value);
}
@Override
public String toString() {
return MoreObjects.toStringHelper(PreferenceMessage.class).add("id", id).add("scope", scope)
.add("source", source).add("user", user).add("key", key).add("value", value).toString();
}
}