001/*
002 * Copyright 2014 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;
021
022import com.google.common.base.Objects;
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 obj) {
062    if (this == obj) {
063      return true;
064    }
065    if (!(obj instanceof TaxonomicCoverages)) {
066      return false;
067    }
068
069    TaxonomicCoverages
070      that = (TaxonomicCoverages) obj;
071    return Objects.equal(this.description, that.description) && Objects.equal(this.coverages, that.coverages);
072  }
073
074  @Override
075  public int hashCode() {
076    return Objects.hashCode(description, coverages);
077  }
078
079  @Override
080  public String toString() {
081    return Objects.toStringHelper(this)
082      .add("description", description)
083      .add("coverages", coverages)
084      .toString();
085  }
086
087}