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