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.occurrence; 017 018import java.util.Objects; 019import java.util.StringJoiner; 020 021import javax.annotation.Nullable; 022import javax.validation.constraints.NotNull; 023 024/** 025 * A measurement or fact about an occurrence. 026 * @see <a href="http://rs.gbif.org/extension/dwc/measurements_or_facts.xml">measurement or fact extension</a> 027 */ 028public class MeasurementOrFact { 029 private String id; 030 private String type; 031 private String value; 032 private String unit; 033 private String accuracy; 034 private String method; 035 private String determinedBy; 036 private String determinedDate; 037 private String remarks; 038 039 @NotNull 040 public String getId() { 041 return id; 042 } 043 044 public void setId(String id) { 045 this.id = id; 046 } 047 048 @NotNull 049 public String getType() { 050 return type; 051 } 052 053 public void setType(String type) { 054 this.type = type; 055 } 056 057 @NotNull 058 public String getValue() { 059 return value; 060 } 061 062 public void setValue(String value) { 063 this.value = value; 064 } 065 066 @Nullable 067 public String getUnit() { 068 return unit; 069 } 070 071 public void setUnit(String unit) { 072 this.unit = unit; 073 } 074 075 @Nullable 076 public String getAccuracy() { 077 return accuracy; 078 } 079 080 public void setAccuracy(String accuracy) { 081 this.accuracy = accuracy; 082 } 083 084 @Nullable 085 public String getMethod() { 086 return method; 087 } 088 089 public void setMethod(String method) { 090 this.method = method; 091 } 092 093 @Nullable 094 public String getDeterminedBy() { 095 return determinedBy; 096 } 097 098 public void setDeterminedBy(String determinedBy) { 099 this.determinedBy = determinedBy; 100 } 101 102 @Nullable 103 public String getDeterminedDate() { 104 return determinedDate; 105 } 106 107 public void setDeterminedDate(String determinedDate) { 108 this.determinedDate = determinedDate; 109 } 110 111 @Nullable 112 public String getRemarks() { 113 return remarks; 114 } 115 116 public void setRemarks(String remarks) { 117 this.remarks = remarks; 118 } 119 120 @Override 121 public boolean equals(Object o) { 122 if (this == o) { 123 return true; 124 } 125 if (o == null || getClass() != o.getClass()) { 126 return false; 127 } 128 MeasurementOrFact that = (MeasurementOrFact) o; 129 return Objects.equals(id, that.id) && 130 Objects.equals(type, that.type) && 131 Objects.equals(value, that.value) && 132 Objects.equals(unit, that.unit) && 133 Objects.equals(accuracy, that.accuracy) && 134 Objects.equals(method, that.method) && 135 Objects.equals(determinedBy, that.determinedBy) && 136 Objects.equals(determinedDate, that.determinedDate) && 137 Objects.equals(remarks, that.remarks); 138 } 139 140 @Override 141 public int hashCode() { 142 return Objects 143 .hash(id, type, value, unit, accuracy, method, determinedBy, determinedDate, remarks); 144 } 145 146 @Override 147 public String toString() { 148 return new StringJoiner(", ", MeasurementOrFact.class.getSimpleName() + "[", "]") 149 .add("id='" + id + "'") 150 .add("type='" + type + "'") 151 .add("value='" + value + "'") 152 .add("unit='" + unit + "'") 153 .add("accuracy='" + accuracy + "'") 154 .add("method='" + method + "'") 155 .add("determinedBy='" + determinedBy + "'") 156 .add("determinedDate='" + determinedDate + "'") 157 .add("remarks='" + remarks + "'") 158 .toString(); 159 } 160 }