001/* 002 * mzTab-M reference implementation and validation API. 003 * This is the mzTab-M reference implementation and validation API service. 004 * 005 * OpenAPI spec version: 2.0.0 006 * Contact: nils.hoffmann@isas.de 007 * 008 * NOTE: This class is auto generated by the swagger code generator program. 009 * https://github.com/swagger-api/swagger-codegen.git 010 * Do not edit the class manually. 011 */ 012 013 014package de.isas.mztab2.model; 015 016import java.util.Objects; 017import java.util.Arrays; 018import com.fasterxml.jackson.annotation.JsonProperty; 019import com.fasterxml.jackson.annotation.JsonCreator; 020import com.fasterxml.jackson.annotation.JsonValue; 021import de.isas.mztab2.model.Parameter; 022import io.swagger.annotations.ApiModel; 023import io.swagger.annotations.ApiModelProperty; 024import java.util.ArrayList; 025import java.util.List; 026import com.fasterxml.jackson.dataformat.xml.annotation.*; 027import javax.xml.bind.annotation.*; 028import javax.validation.constraints.*; 029import javax.validation.Valid; 030import de.isas.lipidomics.mztab2.validation.constraints.*; 031/** 032 * 033 * The name, source, analyzer and detector of the instruments used in the experiment. Multiple instruments are numbered [1-n]. 034 * 035 * 036 * <p>mzTab-M specification example(s):</p> 037 * <pre><code>MTD instrument[1]-name [MS, MS:1000449, LTQ Orbitrap,] 038MTD instrument[1]-source [MS, MS:1000073, ESI,] 039… 040MTD instrument[2]-source [MS, MS:1000598, ETD,] 041MTD instrument[1]-analyzer[1] [MS, MS:1000291, linear ion trap,] 042… 043MTD instrument[2]-analyzer[1] [MS, MS:1000484, orbitrap,] 044MTD instrument[1]-detector [MS, MS:1000253, electron multiplier,] 045… 046MTD instrument[2]-detector [MS, MS:1000348, focal plane collector,] 047</code></pre> 048 * 049 * 050 */ 051@com.fasterxml.jackson.annotation.JsonIdentityInfo(generator = com.fasterxml.jackson.annotation.ObjectIdGenerators.PropertyGenerator.class, property = "id", scope = Instrument.class) 052@ApiModel(description = "The name, source, analyzer and detector of the instruments used in the experiment. Multiple instruments are numbered [1-n].") 053@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2021-01-02T19:25:37.430+01:00") 054@XmlRootElement(name = "Instrument") 055@XmlAccessorType(XmlAccessType.FIELD) 056@JacksonXmlRootElement(localName = "Instrument") 057public class Instrument { 058 059 /** 060 * Property enumeration for Instrument. 061 */ 062 public static enum Properties { 063 id("id"), 064 name("name"), 065 source("source"), 066 analyzer("analyzer"), 067 detector("detector"); 068 069 private final String propertyName; 070 071 private Properties(String propertyName) { 072 this.propertyName = propertyName; 073 } 074 075 public String getPropertyName() { 076 return propertyName; 077 } 078 079 public String toString() { 080 return propertyName; 081 } 082 083 public String toUpper() { 084 return propertyName.toUpperCase(); 085 } 086 087 public static Properties of(String value) { 088 if(value==null) { 089 throw new NullPointerException("Argument value must not be null!"); 090 } 091 return Arrays.asList(Properties.values()).stream().filter(m -> m.propertyName.equals(value.toLowerCase())).findAny().orElseThrow(IllegalArgumentException::new); 092 } 093 }; 094 095 @JsonProperty("id") 096 @JacksonXmlProperty(localName = "id") 097 @XmlElement(name = "id") 098 private Integer id = null; 099 @JsonProperty("name") 100 @JacksonXmlProperty(localName = "name") 101 @XmlElement(name = "name") 102 private Parameter name = null; 103 @JsonProperty("source") 104 @JacksonXmlProperty(localName = "source") 105 @XmlElement(name = "source") 106 private Parameter source = null; 107 @JsonProperty("analyzer") 108 // Is a container wrapped=false 109 // items.name=analyzer items.baseName=analyzer items.xmlName= items.xmlNamespace= 110 // items.example= items.type=Parameter 111 @XmlElement(name = "analyzer") 112 private List<Parameter> analyzer = null; 113 @JsonProperty("detector") 114 @JacksonXmlProperty(localName = "detector") 115 @XmlElement(name = "detector") 116 private Parameter detector = null; 117 118 /** 119 * Builder method for id. 120 * 121 * @see Instrument#setId Instrument#setId for specification examples 122 * @see Instrument#getId Instrument#getId for validation constraints 123 * @param id a {@code Integer} parameter. 124 * @return Instrument 125 **/ 126 public Instrument id(Integer id) { 127 this.id = id; 128 return this; 129 } 130 131 /** 132 * <p>Get id.</p> 133 * 134 * <p>Minimum: 1</p> 135 * @return id 136 **/ 137 @Min(1) @ApiModelProperty(value = "") 138 public Integer getId() { 139 return id; 140 } 141 142 /** 143 * Set id. 144 * 145 * 146 * 147 * @see #getId Instrument#getId for validation constraints 148 * @param id a {@code Integer} parameter. 149 **/ 150 public void setId(Integer id) { 151 this.id = id; 152 } 153 154 155 /** 156 * Builder method for name. 157 * 158 * @see Instrument#setName Instrument#setName for specification examples 159 * @see Instrument#getName Instrument#getName for validation constraints 160 * @param name a {@code Parameter} parameter. 161 * @return Instrument 162 **/ 163 public Instrument name(Parameter name) { 164 this.name = name; 165 return this; 166 } 167 168 /** 169 * <p>Get name.</p> 170 * 171 * @return name 172 **/ 173 @Valid 174 @ApiModelProperty(value = "") 175 public Parameter getName() { 176 return name; 177 } 178 179 /** 180 * Set name. 181 * 182 * 183 * 184 * @see #getName Instrument#getName for validation constraints 185 * @param name a {@code Parameter} parameter. 186 **/ 187 public void setName(Parameter name) { 188 this.name = name; 189 } 190 191 192 /** 193 * Builder method for source. 194 * 195 * @see Instrument#setSource Instrument#setSource for specification examples 196 * @see Instrument#getSource Instrument#getSource for validation constraints 197 * @param source a {@code Parameter} parameter. 198 * @return Instrument 199 **/ 200 public Instrument source(Parameter source) { 201 this.source = source; 202 return this; 203 } 204 205 /** 206 * The instrument's source, as defined by the parameter. 207 * 208 * @return source 209 **/ 210 @Valid 211 @ApiModelProperty(value = "The instrument's source, as defined by the parameter.") 212 public Parameter getSource() { 213 return source; 214 } 215 216 /** 217 * Set source. 218 * 219 * 220 * 221 * @see #getSource Instrument#getSource for validation constraints 222 * @param source a {@code Parameter} parameter. 223 **/ 224 public void setSource(Parameter source) { 225 this.source = source; 226 } 227 228 229 /** 230 * Builder method for analyzer. 231 * 232 * @see Instrument#setAnalyzer Instrument#setAnalyzer for specification examples 233 * @see Instrument#getAnalyzer Instrument#getAnalyzer for validation constraints 234 * @param analyzer a {@code List<Parameter>} parameter. 235 * @return Instrument 236 **/ 237 public Instrument analyzer(List<Parameter> analyzer) { 238 this.analyzer = analyzer; 239 return this; 240 } 241 242 /** 243 * Add a single analyzerItem to the analyzer collection. 244 * 245 * @see Instrument#getAnalyzer Instrument#getAnalyzer for validation constraints 246 * @param analyzerItem a {@code Parameter} parameter. 247 * @return Instrument 248 */ 249 public Instrument addAnalyzerItem(Parameter analyzerItem) { 250 if (this.analyzer == null) { 251 this.analyzer = new ArrayList<>(); 252 } 253 this.analyzer.add(analyzerItem); 254 return this; 255 } 256 257 /** 258 * The instrument's mass analyzer, as defined by the parameter. 259 * 260 * @return analyzer 261 **/ 262 @Valid 263 @ApiModelProperty(value = "The instrument's mass analyzer, as defined by the parameter.") 264 public List<Parameter> getAnalyzer() { 265 return analyzer; 266 } 267 268 /** 269 * Set analyzer. 270 * 271 * 272 * 273 * @see #getAnalyzer Instrument#getAnalyzer for validation constraints 274 * @param analyzer a {@code List<Parameter>} parameter. 275 **/ 276 public void setAnalyzer(List<Parameter> analyzer) { 277 this.analyzer = analyzer; 278 } 279 280 281 /** 282 * Builder method for detector. 283 * 284 * @see Instrument#setDetector Instrument#setDetector for specification examples 285 * @see Instrument#getDetector Instrument#getDetector for validation constraints 286 * @param detector a {@code Parameter} parameter. 287 * @return Instrument 288 **/ 289 public Instrument detector(Parameter detector) { 290 this.detector = detector; 291 return this; 292 } 293 294 /** 295 * The instrument's detector, as defined by the parameter. 296 * 297 * @return detector 298 **/ 299 @Valid 300 @ApiModelProperty(value = "The instrument's detector, as defined by the parameter.") 301 public Parameter getDetector() { 302 return detector; 303 } 304 305 /** 306 * Set detector. 307 * 308 * 309 * 310 * @see #getDetector Instrument#getDetector for validation constraints 311 * @param detector a {@code Parameter} parameter. 312 **/ 313 public void setDetector(Parameter detector) { 314 this.detector = detector; 315 } 316 317 318 @Override 319 public boolean equals(java.lang.Object o) { 320 if (this == o) { 321 return true; 322 } 323 if (o == null || getClass() != o.getClass()) { 324 return false; 325 } 326 Instrument instrument = (Instrument) o; 327 return Objects.equals(this.id, instrument.id) && 328 Objects.equals(this.name, instrument.name) && 329 Objects.equals(this.source, instrument.source) && 330 Objects.equals(this.analyzer, instrument.analyzer) && 331 Objects.equals(this.detector, instrument.detector); 332 } 333 334 @Override 335 public int hashCode() { 336 return Objects.hash(id, name, source, analyzer, detector); 337 } 338 339 340 @Override 341 public String toString() { 342 StringBuilder sb = new StringBuilder(); 343 sb.append("class Instrument {\n"); 344 345 sb.append(" id: ").append(toIndentedString(id)).append("\n"); 346 sb.append(" name: ").append(toIndentedString(name)).append("\n"); 347 sb.append(" source: ").append(toIndentedString(source)).append("\n"); 348 sb.append(" analyzer: ").append(toIndentedString(analyzer)).append("\n"); 349 sb.append(" detector: ").append(toIndentedString(detector)).append("\n"); 350 sb.append("}"); 351 return sb.toString(); 352 } 353 354 /** 355 * Convert the given object to string with each line indented by 4 spaces 356 * (except the first line). 357 */ 358 private String toIndentedString(java.lang.Object o) { 359 if (o == null) { 360 return "null"; 361 } 362 return o.toString().replace("\n", "\n "); 363 } 364 365} 366