/* * This file is part of Bitsquare. * * Bitsquare is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. * * Bitsquare is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public * License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>. */ package io.bitsquare.locale; import io.bitsquare.app.Version; import io.bitsquare.common.persistance.Persistable; import javax.annotation.concurrent.Immutable; @Immutable public final class Country implements Persistable { // That object is saved to disc. We need to take care of changes to not break deserialization. private static final long serialVersionUID = Version.LOCAL_DB_VERSION; public final String code; public final String name; public final Region region; public Country(String code, String name, Region region) { this.code = code; this.name = name; this.region = region; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Country country = (Country) o; if (code != null ? !code.equals(country.code) : country.code != null) return false; //noinspection SimplifiableIfStatement if (name != null ? !name.equals(country.name) : country.name != null) return false; return !(region != null ? !region.equals(country.region) : country.region != null); } @Override public int hashCode() { int result = code != null ? code.hashCode() : 0; result = 31 * result + (name != null ? name.hashCode() : 0); result = 31 * result + (region != null ? region.hashCode() : 0); return result; } @Override public String toString() { return "Country{" + "code='" + code + '\'' + ", name='" + name + '\'' + ", region=" + region + '}'; } }