001package org.gbif.api.model.occurrence;
002
003import javax.annotation.Nullable;
004import javax.validation.constraints.NotNull;
005
006import com.google.common.base.Objects;
007
008/**
009 * A fact or measurement about an occurrence.
010 * @see <a href="http://rs.gbif.org/extension/dwc/measurements_or_facts.xml">Fact extension</a>
011 */
012public class FactOrMeasurment {
013  private String id;
014  private String type;
015  private String value;
016  private String unit;
017  private String accuracy;
018  private String method;
019  private String determinedBy;
020  private String determinedDate;
021  private String remarks;
022
023  @NotNull
024  public String getId() {
025    return id;
026  }
027
028  public void setId(String id) {
029    this.id = id;
030  }
031
032  @NotNull
033  public String getType() {
034    return type;
035  }
036
037  public void setType(String type) {
038    this.type = type;
039  }
040
041  @NotNull
042  public String getValue() {
043    return value;
044  }
045
046  public void setValue(String value) {
047    this.value = value;
048  }
049
050  @Nullable
051  public String getUnit() {
052    return unit;
053  }
054
055  public void setUnit(String unit) {
056    this.unit = unit;
057  }
058
059  @Nullable
060  public String getAccuracy() {
061    return accuracy;
062  }
063
064  public void setAccuracy(String accuracy) {
065    this.accuracy = accuracy;
066  }
067
068  @Nullable
069  public String getMethod() {
070    return method;
071  }
072
073  public void setMethod(String method) {
074    this.method = method;
075  }
076
077  @Nullable
078  public String getDeterminedBy() {
079    return determinedBy;
080  }
081
082  public void setDeterminedBy(String determinedBy) {
083    this.determinedBy = determinedBy;
084  }
085
086  @Nullable
087  public String getDeterminedDate() {
088    return determinedDate;
089  }
090
091  public void setDeterminedDate(String determinedDate) {
092    this.determinedDate = determinedDate;
093  }
094
095  @Nullable
096  public String getRemarks() {
097    return remarks;
098  }
099
100  public void setRemarks(String remarks) {
101    this.remarks = remarks;
102  }
103
104  @Override
105  public int hashCode() {
106    return Objects.hashCode(id, type, value, unit, accuracy, method, determinedBy, determinedDate, remarks);
107  }
108
109  @Override
110  public boolean equals(Object obj) {
111    if (this == obj) {
112      return true;
113    }
114    if (!(obj instanceof FactOrMeasurment)) {
115      return false;
116    }
117    FactOrMeasurment that = (FactOrMeasurment) obj;
118    return Objects.equal(this.id, that.id)
119        && Objects.equal(this.type, that.type)
120        && Objects.equal(this.value, that.value)
121        && Objects.equal(this.unit, that.unit)
122        && Objects.equal(this.accuracy, that.accuracy)
123        && Objects.equal(this.method, that.method)
124        && Objects.equal(this.determinedBy, that.determinedBy)
125        && Objects.equal(this.determinedDate, that.determinedDate)
126        && Objects.equal(this.remarks, that.remarks);
127  }
128
129  @Override
130  public String toString() {
131    return Objects.toStringHelper(this)
132      .add("id", id)
133      .add("type", type)
134      .add("value", value)
135      .add("unit", unit)
136      .add("accuracy", accuracy)
137      .add("method", method)
138      .add("determinedBy", determinedBy)
139      .add("determinedDate", determinedDate)
140      .add("remarks", remarks)
141      .toString();
142  }
143
144 }