/* * Copyright 2015 Trento Rise (trentorise.eu) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package eu.trentorise.opendata.jackan.model; import java.util.Objects; import javax.annotation.Nullable; /** * For key/value pairs present in extras field. Implements equals and hashCode. * * @author David Leoni */ public class CkanPair { private String key; @Nullable private String value; public CkanPair() { } public CkanPair(String key, @Nullable String value) { this.key = key; this.value = value; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } @Nullable public String getValue() { return value; } public void setValue(@Nullable String value) { this.value = value; } @Override public int hashCode() { int hash = 3; hash = 97 * hash + Objects.hashCode(this.key); hash = 97 * hash + Objects.hashCode(this.value); return hash; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final CkanPair other = (CkanPair) obj; if (!Objects.equals(this.key, other.key)) { return false; } if (!Objects.equals(this.value, other.value)) { return false; } return true; } }