001/* 002 * Copyright 2020 Global Biodiversity Information Facility (GBIF) 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.gbif.api.model.registry.eml; 017 018import org.gbif.api.model.common.InterpretedEnum; 019import org.gbif.api.vocabulary.Rank; 020 021import java.io.Serializable; 022import java.util.Objects; 023import java.util.StringJoiner; 024 025/** 026 * An individual coverage. 027 */ 028public class TaxonomicCoverage implements Serializable { 029 030 private static final long serialVersionUID = 7567059548990081342L; 031 032 private String scientificName; 033 034 private String commonName; 035 036 private InterpretedEnum<String, Rank> rank; 037 038 public TaxonomicCoverage() { 039 } 040 041 public TaxonomicCoverage(String scientificName, String commonName, InterpretedEnum<String, Rank> rank) { 042 this.scientificName = scientificName; 043 this.commonName = commonName; 044 this.rank = rank; 045 } 046 047 public String getCommonName() { 048 return commonName; 049 } 050 051 public void setCommonName(String commonName) { 052 this.commonName = commonName; 053 } 054 055 public InterpretedEnum<String, Rank> getRank() { 056 return rank; 057 } 058 059 public void setRank(InterpretedEnum<String, Rank> rank) { 060 this.rank = rank; 061 } 062 063 public String getScientificName() { 064 return scientificName; 065 } 066 067 public void setScientificName(String scientificName) { 068 this.scientificName = scientificName; 069 } 070 071 @Override 072 public boolean equals(Object o) { 073 if (this == o) { 074 return true; 075 } 076 if (o == null || getClass() != o.getClass()) { 077 return false; 078 } 079 TaxonomicCoverage that = (TaxonomicCoverage) o; 080 return Objects.equals(scientificName, that.scientificName) && 081 Objects.equals(commonName, that.commonName) && 082 Objects.equals(rank, that.rank); 083 } 084 085 @Override 086 public int hashCode() { 087 return Objects.hash(scientificName, commonName, rank); 088 } 089 090 @Override 091 public String toString() { 092 return new StringJoiner(", ", TaxonomicCoverage.class.getSimpleName() + "[", "]") 093 .add("scientificName='" + scientificName + "'") 094 .add("commonName='" + commonName + "'") 095 .add("rank=" + rank) 096 .toString(); 097 } 098}