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 java.io.Serializable;
019import java.util.ArrayList;
020import java.util.List;
021import java.util.Objects;
022import java.util.StringJoiner;
023
024public class TaxonomicCoverages implements Serializable {
025
026  private static final long serialVersionUID = 334156985829698279L;
027
028  private String description;
029
030  private List<TaxonomicCoverage> coverages = new ArrayList<TaxonomicCoverage>();
031
032  public TaxonomicCoverages() {
033  }
034
035  public TaxonomicCoverages(String description, List<TaxonomicCoverage> coverages) {
036    this.description = description;
037    this.coverages = coverages;
038  }
039
040  public List<TaxonomicCoverage> getCoverages() {
041    return coverages;
042  }
043
044  public void setCoverages(List<TaxonomicCoverage> coverages) {
045    this.coverages = coverages;
046  }
047
048  public String getDescription() {
049    return description;
050  }
051
052  public void setDescription(String description) {
053    this.description = description;
054  }
055
056  public void addCoverages(TaxonomicCoverage coverage) {
057    coverages.add(coverage);
058  }
059
060  @Override
061  public boolean equals(Object o) {
062    if (this == o) {
063      return true;
064    }
065    if (o == null || getClass() != o.getClass()) {
066      return false;
067    }
068    TaxonomicCoverages that = (TaxonomicCoverages) o;
069    return Objects.equals(description, that.description) &&
070      Objects.equals(coverages, that.coverages);
071  }
072
073  @Override
074  public int hashCode() {
075    return Objects.hash(description, coverages);
076  }
077
078  @Override
079  public String toString() {
080    return new StringJoiner(", ", TaxonomicCoverages.class.getSimpleName() + "[", "]")
081      .add("description='" + description + "'")
082      .add("coverages=" + coverages)
083      .toString();
084  }
085}