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 * Specification of sample. 035(empty) name: A name for each sample to serve as a list of the samples that MUST be reported in the following tables. Samples MUST be reported if a statistical design is being captured (i.e. bio or tech replicates). If the type of replicates are not known, samples SHOULD NOT be reported. 036species: The respective species of the samples analysed. For more complex cases, such as metagenomics, optional columns and userParams should be used. 037tissue: The respective tissue(s) of the sample. 038cell_type: The respective cell type(s) of the sample. 039disease: The respective disease(s) of the sample. 040description: A human readable description of the sample. 041custom: Custom parameters describing the sample's additional properties. Dates MUST be provided in ISO-8601 format. 042 043 * 044 * 045 * <p>mzTab-M specification example(s):</p> 046 * <pre><code>COM Experiment where all samples consisted of the same two species 047MTD sample[1] individual number 1 048MTD sample[1]-species[1] [NCBITaxon, NCBITaxon:9606, Homo sapiens, ] 049MTD sample[1]-tissue[1] [BTO, BTO:0000759, liver, ] 050MTD sample[1]-cell_type[1] [CL, CL:0000182, hepatocyte, ] 051MTD sample[1]-disease[1] [DOID, DOID:684, hepatocellular carcinoma, ] 052MTD sample[1]-disease[2] [DOID, DOID:9451, alcoholic fatty liver, ] 053MTD sample[1]-description Hepatocellular carcinoma samples. 054MTD sample[1]-custom[1] [,,Extraction date, 2011-12-21] 055MTD sample[1]-custom[2] [,,Extraction reason, liver biopsy] 056MTD sample[2] individual number 2 057MTD sample[2]-species[1] [NCBITaxon, NCBITaxon:9606, Homo sapiens, ] 058MTD sample[2]-tissue[1] [BTO, BTO:0000759, liver, ] 059MTD sample[2]-cell_type[1] [CL, CL:0000182, hepatocyte, ] 060MTD sample[2]-description Healthy control samples. 061</code></pre> 062 * 063 * 064 */ 065@ApiModel(description = "Specification of sample. (empty) name: A name for each sample to serve as a list of the samples that MUST be reported in the following tables. Samples MUST be reported if a statistical design is being captured (i.e. bio or tech replicates). If the type of replicates are not known, samples SHOULD NOT be reported. species: The respective species of the samples analysed. For more complex cases, such as metagenomics, optional columns and userParams should be used. tissue: The respective tissue(s) of the sample. cell_type: The respective cell type(s) of the sample. disease: The respective disease(s) of the sample. description: A human readable description of the sample. custom: Custom parameters describing the sample's additional properties. Dates MUST be provided in ISO-8601 format. ") 066@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-08-07T11:09:24.487+02:00") 067@XmlRootElement(name = "Sample") 068@XmlAccessorType(XmlAccessType.FIELD) 069@JacksonXmlRootElement(localName = "Sample") 070public class Sample extends IndexedElement { 071 072 /** 073 * Property enumeration for Sample. 074 */ 075 public static enum Properties { 076 name("name"), 077 custom("custom"), 078 species("species"), 079 tissue("tissue"), 080 cellType("cell_type"), 081 disease("disease"), 082 description("description"); 083 084 private final String propertyName; 085 086 private Properties(String propertyName) { 087 this.propertyName = propertyName; 088 } 089 090 public String getPropertyName() { 091 return propertyName; 092 } 093 094 public String toString() { 095 return propertyName; 096 } 097 098 public String toUpper() { 099 return propertyName.toUpperCase(); 100 } 101 102 public static Properties of(String value) { 103 if(value==null) { 104 throw new NullPointerException("Argument value must not be null!"); 105 } 106 return Arrays.asList(Properties.values()).stream().filter(m -> m.propertyName.equals(value.toLowerCase())).findAny().orElseThrow(IllegalArgumentException::new); 107 } 108 }; 109 110 @JsonProperty("name") 111 @JacksonXmlProperty(localName = "name") 112 @XmlElement(name = "name") 113 private String name = null; 114 @JsonProperty("custom") 115 // Is a container wrapped=false 116 // items.name=custom items.baseName=custom items.xmlName= items.xmlNamespace= 117 // items.example= items.type=Parameter 118 @XmlElement(name = "custom") 119 private List<Parameter> custom = null; 120 @JsonProperty("species") 121 // Is a container wrapped=false 122 // items.name=species items.baseName=species items.xmlName= items.xmlNamespace= 123 // items.example= items.type=Parameter 124 @XmlElement(name = "species") 125 private List<Parameter> species = null; 126 @JsonProperty("tissue") 127 // Is a container wrapped=false 128 // items.name=tissue items.baseName=tissue items.xmlName= items.xmlNamespace= 129 // items.example= items.type=Parameter 130 @XmlElement(name = "tissue") 131 private List<Parameter> tissue = null; 132 @JsonProperty("cell_type") 133 // Is a container wrapped=false 134 // items.name=cellType items.baseName=cellType items.xmlName= items.xmlNamespace= 135 // items.example= items.type=Parameter 136 @XmlElement(name = "cellType") 137 private List<Parameter> cellType = null; 138 @JsonProperty("disease") 139 // Is a container wrapped=false 140 // items.name=disease items.baseName=disease items.xmlName= items.xmlNamespace= 141 // items.example= items.type=Parameter 142 @XmlElement(name = "disease") 143 private List<Parameter> disease = null; 144 @JsonProperty("description") 145 @JacksonXmlProperty(localName = "description") 146 @XmlElement(name = "description") 147 private String description = null; 148 149 @Override 150 public Sample id(Integer id) { 151 super.setId(id); 152 return this; 153 } 154 155 @Override 156 public Sample elementType(String elementType) { 157 super.setElementType(elementType); 158 return this; 159 } 160 161 /** 162 * Builder method for name. 163 * 164 * @see Sample#setName Sample#setName for specification examples 165 * @see Sample#getName Sample#getName for validation constraints 166 * @param name a {@code String} parameter. 167 * @return Sample 168 **/ 169 public Sample name(String name) { 170 this.name = name; 171 return this; 172 } 173 174 /** 175 * The sample's name. 176 * 177 * @return name 178 **/ 179 @ApiModelProperty(value = "The sample's name.") 180 public String getName() { 181 return name; 182 } 183 184 /** 185 * Set name. 186 * 187 * 188 * 189 * @see #getName Sample#getName for validation constraints 190 * @param name a {@code String} parameter. 191 **/ 192 public void setName(String name) { 193 this.name = name; 194 } 195 196 197 /** 198 * Builder method for custom. 199 * 200 * @see Sample#setCustom Sample#setCustom for specification examples 201 * @see Sample#getCustom Sample#getCustom for validation constraints 202 * @param custom a {@code List<Parameter>} parameter. 203 * @return Sample 204 **/ 205 public Sample custom(List<Parameter> custom) { 206 this.custom = custom; 207 return this; 208 } 209 210 /** 211 * Add a single customItem to the custom collection. 212 * 213 * @see Sample#getCustom Sample#getCustom for validation constraints 214 * @param customItem a {@code Parameter} parameter. 215 * @return Sample 216 */ 217 public Sample addCustomItem(Parameter customItem) { 218 if (this.custom == null) { 219 this.custom = new ArrayList<>(); 220 } 221 this.custom.add(customItem); 222 return this; 223 } 224 225 /** 226 * Additional user or cv parameters. 227 * 228 * @return custom 229 **/ 230 @Valid 231 @ApiModelProperty(value = "Additional user or cv parameters.") 232 public List<Parameter> getCustom() { 233 return custom; 234 } 235 236 /** 237 * Set custom. 238 * 239 * 240 * 241 * @see #getCustom Sample#getCustom for validation constraints 242 * @param custom a {@code List<Parameter>} parameter. 243 **/ 244 public void setCustom(List<Parameter> custom) { 245 this.custom = custom; 246 } 247 248 249 /** 250 * Builder method for species. 251 * 252 * @see Sample#setSpecies Sample#setSpecies for specification examples 253 * @see Sample#getSpecies Sample#getSpecies for validation constraints 254 * @param species a {@code List<Parameter>} parameter. 255 * @return Sample 256 **/ 257 public Sample species(List<Parameter> species) { 258 this.species = species; 259 return this; 260 } 261 262 /** 263 * Add a single speciesItem to the species collection. 264 * 265 * @see Sample#getSpecies Sample#getSpecies for validation constraints 266 * @param speciesItem a {@code Parameter} parameter. 267 * @return Sample 268 */ 269 public Sample addSpeciesItem(Parameter speciesItem) { 270 if (this.species == null) { 271 this.species = new ArrayList<>(); 272 } 273 this.species.add(speciesItem); 274 return this; 275 } 276 277 /** 278 * Biological species information on the sample. 279 * 280 * @return species 281 **/ 282 @Valid 283 @ApiModelProperty(value = "Biological species information on the sample.") 284 public List<Parameter> getSpecies() { 285 return species; 286 } 287 288 /** 289 * Set species. 290 * 291 * 292 * 293 * @see #getSpecies Sample#getSpecies for validation constraints 294 * @param species a {@code List<Parameter>} parameter. 295 **/ 296 public void setSpecies(List<Parameter> species) { 297 this.species = species; 298 } 299 300 301 /** 302 * Builder method for tissue. 303 * 304 * @see Sample#setTissue Sample#setTissue for specification examples 305 * @see Sample#getTissue Sample#getTissue for validation constraints 306 * @param tissue a {@code List<Parameter>} parameter. 307 * @return Sample 308 **/ 309 public Sample tissue(List<Parameter> tissue) { 310 this.tissue = tissue; 311 return this; 312 } 313 314 /** 315 * Add a single tissueItem to the tissue collection. 316 * 317 * @see Sample#getTissue Sample#getTissue for validation constraints 318 * @param tissueItem a {@code Parameter} parameter. 319 * @return Sample 320 */ 321 public Sample addTissueItem(Parameter tissueItem) { 322 if (this.tissue == null) { 323 this.tissue = new ArrayList<>(); 324 } 325 this.tissue.add(tissueItem); 326 return this; 327 } 328 329 /** 330 * Biological tissue information on the sample. 331 * 332 * @return tissue 333 **/ 334 @Valid 335 @ApiModelProperty(value = "Biological tissue information on the sample.") 336 public List<Parameter> getTissue() { 337 return tissue; 338 } 339 340 /** 341 * Set tissue. 342 * 343 * 344 * 345 * @see #getTissue Sample#getTissue for validation constraints 346 * @param tissue a {@code List<Parameter>} parameter. 347 **/ 348 public void setTissue(List<Parameter> tissue) { 349 this.tissue = tissue; 350 } 351 352 353 /** 354 * Builder method for cellType. 355 * 356 * @see Sample#setCellType Sample#setCellType for specification examples 357 * @see Sample#getCellType Sample#getCellType for validation constraints 358 * @param cellType a {@code List<Parameter>} parameter. 359 * @return Sample 360 **/ 361 public Sample cellType(List<Parameter> cellType) { 362 this.cellType = cellType; 363 return this; 364 } 365 366 /** 367 * Add a single cellTypeItem to the cellType collection. 368 * 369 * @see Sample#getCellType Sample#getCellType for validation constraints 370 * @param cellTypeItem a {@code Parameter} parameter. 371 * @return Sample 372 */ 373 public Sample addCellTypeItem(Parameter cellTypeItem) { 374 if (this.cellType == null) { 375 this.cellType = new ArrayList<>(); 376 } 377 this.cellType.add(cellTypeItem); 378 return this; 379 } 380 381 /** 382 * Biological cell type information on the sample. 383 * 384 * @return cellType 385 **/ 386 @Valid 387 @ApiModelProperty(value = "Biological cell type information on the sample.") 388 public List<Parameter> getCellType() { 389 return cellType; 390 } 391 392 /** 393 * Set cellType. 394 * 395 * 396 * 397 * @see #getCellType Sample#getCellType for validation constraints 398 * @param cellType a {@code List<Parameter>} parameter. 399 **/ 400 public void setCellType(List<Parameter> cellType) { 401 this.cellType = cellType; 402 } 403 404 405 /** 406 * Builder method for disease. 407 * 408 * @see Sample#setDisease Sample#setDisease for specification examples 409 * @see Sample#getDisease Sample#getDisease for validation constraints 410 * @param disease a {@code List<Parameter>} parameter. 411 * @return Sample 412 **/ 413 public Sample disease(List<Parameter> disease) { 414 this.disease = disease; 415 return this; 416 } 417 418 /** 419 * Add a single diseaseItem to the disease collection. 420 * 421 * @see Sample#getDisease Sample#getDisease for validation constraints 422 * @param diseaseItem a {@code Parameter} parameter. 423 * @return Sample 424 */ 425 public Sample addDiseaseItem(Parameter diseaseItem) { 426 if (this.disease == null) { 427 this.disease = new ArrayList<>(); 428 } 429 this.disease.add(diseaseItem); 430 return this; 431 } 432 433 /** 434 * Disease information on the sample. 435 * 436 * @return disease 437 **/ 438 @Valid 439 @ApiModelProperty(value = "Disease information on the sample.") 440 public List<Parameter> getDisease() { 441 return disease; 442 } 443 444 /** 445 * Set disease. 446 * 447 * 448 * 449 * @see #getDisease Sample#getDisease for validation constraints 450 * @param disease a {@code List<Parameter>} parameter. 451 **/ 452 public void setDisease(List<Parameter> disease) { 453 this.disease = disease; 454 } 455 456 457 /** 458 * Builder method for description. 459 * 460 * @see Sample#setDescription Sample#setDescription for specification examples 461 * @see Sample#getDescription Sample#getDescription for validation constraints 462 * @param description a {@code String} parameter. 463 * @return Sample 464 **/ 465 public Sample description(String description) { 466 this.description = description; 467 return this; 468 } 469 470 /** 471 * A free form description of the sample. 472 * 473 * @return description 474 **/ 475 @ApiModelProperty(value = "A free form description of the sample.") 476 public String getDescription() { 477 return description; 478 } 479 480 /** 481 * Set description. 482 * 483 * 484 * 485 * @see #getDescription Sample#getDescription for validation constraints 486 * @param description a {@code String} parameter. 487 **/ 488 public void setDescription(String description) { 489 this.description = description; 490 } 491 492 493 @Override 494 public boolean equals(java.lang.Object o) { 495 if (this == o) { 496 return true; 497 } 498 if (o == null || getClass() != o.getClass()) { 499 return false; 500 } 501 Sample sample = (Sample) o; 502 return Objects.equals(this.name, sample.name) && 503 Objects.equals(this.custom, sample.custom) && 504 Objects.equals(this.species, sample.species) && 505 Objects.equals(this.tissue, sample.tissue) && 506 Objects.equals(this.cellType, sample.cellType) && 507 Objects.equals(this.disease, sample.disease) && 508 Objects.equals(this.description, sample.description) && 509 super.equals(o); 510 } 511 512 @Override 513 public int hashCode() { 514 return Objects.hash(name, custom, species, tissue, cellType, disease, description, super.hashCode()); 515 } 516 517 518 @Override 519 public String toString() { 520 StringBuilder sb = new StringBuilder(); 521 sb.append("class Sample {\n"); 522 sb.append(" ").append(toIndentedString(super.toString())).append("\n"); 523 sb.append(" name: ").append(toIndentedString(name)).append("\n"); 524 sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); 525 sb.append(" species: ").append(toIndentedString(species)).append("\n"); 526 sb.append(" tissue: ").append(toIndentedString(tissue)).append("\n"); 527 sb.append(" cellType: ").append(toIndentedString(cellType)).append("\n"); 528 sb.append(" disease: ").append(toIndentedString(disease)).append("\n"); 529 sb.append(" description: ").append(toIndentedString(description)).append("\n"); 530 sb.append("}"); 531 return sb.toString(); 532 } 533 534 /** 535 * Convert the given object to string with each line indented by 4 spaces 536 * (except the first line). 537 */ 538 private String toIndentedString(java.lang.Object o) { 539 if (o == null) { 540 return "null"; 541 } 542 return o.toString().replace("\n", "\n "); 543 } 544 545} 546