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.JsonSubTypes; 021import com.fasterxml.jackson.annotation.JsonTypeInfo; 022import com.fasterxml.jackson.annotation.JsonValue; 023import io.swagger.annotations.ApiModel; 024import io.swagger.annotations.ApiModelProperty; 025import com.fasterxml.jackson.dataformat.xml.annotation.*; 026import javax.xml.bind.annotation.*; 027import javax.validation.constraints.*; 028import javax.validation.Valid; 029import de.isas.lipidomics.mztab2.validation.constraints.*; 030/** 031 * 032 * Indexed elements (IDs) define a unique ID for a collection of multiple metadata elements of the same type within the mzTab-M document, e.g. for sample, assay, study variable etc. 033 * 034 * 035 * <p>mzTab-M specification example(s):</p> 036 * <pre><code>MTD sample[1]-species[1] [NCBITaxon, NCBITaxon:9606, Homo sapiens, ] 037MTD assay[1] first assay description 038MTD study_variable[1] Group B (spike-in 0.74 fmol/uL) 039</code></pre> 040 * 041 * 042 */ 043@ApiModel(description = "Indexed elements (IDs) define a unique ID for a collection of multiple metadata elements of the same type within the mzTab-M document, e.g. for sample, assay, study variable etc.") 044@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2020-02-11T15:12:05.057+01:00")@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "elementType", visible = true ) 045@JsonSubTypes({ 046 @JsonSubTypes.Type(value = Uri.class, name = "Uri"), 047 @JsonSubTypes.Type(value = Assay.class, name = "Assay"), 048 @JsonSubTypes.Type(value = MsRun.class, name = "MsRun"), 049 @JsonSubTypes.Type(value = Database.class, name = "Database"), 050 @JsonSubTypes.Type(value = StudyVariable.class, name = "StudyVariable"), 051 @JsonSubTypes.Type(value = SampleProcessing.class, name = "SampleProcessing"), 052 @JsonSubTypes.Type(value = Sample.class, name = "Sample"), 053 @JsonSubTypes.Type(value = Publication.class, name = "Publication"), 054 @JsonSubTypes.Type(value = Contact.class, name = "Contact"), 055 @JsonSubTypes.Type(value = CV.class, name = "CV"), 056 @JsonSubTypes.Type(value = Instrument.class, name = "Instrument"), 057 @JsonSubTypes.Type(value = Parameter.class, name = "Parameter"), 058 @JsonSubTypes.Type(value = Software.class, name = "Software"), 059}) 060 061@XmlRootElement(name = "IndexedElement") 062@XmlAccessorType(XmlAccessType.FIELD) 063@JacksonXmlRootElement(localName = "IndexedElement") 064public class IndexedElement { 065 066 /** 067 * Property enumeration for IndexedElement. 068 */ 069 public static enum Properties { 070 id("id"), 071 elementType("elementType"); 072 073 private final String propertyName; 074 075 private Properties(String propertyName) { 076 this.propertyName = propertyName; 077 } 078 079 public String getPropertyName() { 080 return propertyName; 081 } 082 083 public String toString() { 084 return propertyName; 085 } 086 087 public String toUpper() { 088 return propertyName.toUpperCase(); 089 } 090 091 public static Properties of(String value) { 092 if(value==null) { 093 throw new NullPointerException("Argument value must not be null!"); 094 } 095 return Arrays.asList(Properties.values()).stream().filter(m -> m.propertyName.equals(value.toLowerCase())).findAny().orElseThrow(IllegalArgumentException::new); 096 } 097 }; 098 099 @JsonProperty("id") 100 @JacksonXmlProperty(localName = "id") 101 @XmlElement(name = "id") 102 private Integer id = null; 103 @JsonProperty("elementType") 104 @JacksonXmlProperty(localName = "elementType") 105 @XmlElement(name = "elementType") 106 private String elementType = "element_type"; 107 108 /** 109 * Builder method for id. 110 * 111 * @see IndexedElement#setId IndexedElement#setId for specification examples 112 * @see IndexedElement#getId IndexedElement#getId for validation constraints 113 * @param id a {@code Integer} parameter. 114 * @return IndexedElement 115 **/ 116 public IndexedElement id(Integer id) { 117 this.id = id; 118 return this; 119 } 120 121 /** 122 * <p>Get id.</p> 123 * 124 * <p>Minimum: 1</p> 125 * @return id 126 **/ 127 @NotNull 128 @Min(1) @ApiModelProperty(required = true, value = "") 129 public Integer getId() { 130 return id; 131 } 132 133 /** 134 * Set id. 135 * 136 * 137 * 138 * @see #getId IndexedElement#getId for validation constraints 139 * @param id a {@code Integer} parameter. 140 **/ 141 public void setId(Integer id) { 142 this.id = id; 143 } 144 145 146 /** 147 * Builder method for elementType. 148 * 149 * @see IndexedElement#setElementType IndexedElement#setElementType for specification examples 150 * @see IndexedElement#getElementType IndexedElement#getElementType for validation constraints 151 * @param elementType a {@code String} parameter. 152 * @return IndexedElement 153 **/ 154 public IndexedElement elementType(String elementType) { 155 this.elementType = elementType; 156 return this; 157 } 158 159 /** 160 * <p>Get elementType.</p> 161 * 162 * @return elementType 163 **/ 164 @NotNull 165 @ApiModelProperty(required = true, value = "") 166 public String getElementType() { 167 return elementType; 168 } 169 170 /** 171 * Set elementType. 172 * 173 * 174 * 175 * @see #getElementType IndexedElement#getElementType for validation constraints 176 * @param elementType a {@code String} parameter. 177 **/ 178 public void setElementType(String elementType) { 179 this.elementType = elementType; 180 } 181 182 183 @Override 184 public boolean equals(java.lang.Object o) { 185 if (this == o) { 186 return true; 187 } 188 if (o == null || getClass() != o.getClass()) { 189 return false; 190 } 191 IndexedElement indexedElement = (IndexedElement) o; 192 return Objects.equals(this.id, indexedElement.id) && 193 Objects.equals(this.elementType, indexedElement.elementType); 194 } 195 196 @Override 197 public int hashCode() { 198 return Objects.hash(id, elementType); 199 } 200 201 202 @Override 203 public String toString() { 204 StringBuilder sb = new StringBuilder(); 205 sb.append("class IndexedElement {\n"); 206 207 sb.append(" id: ").append(toIndentedString(id)).append("\n"); 208 sb.append(" elementType: ").append(toIndentedString(elementType)).append("\n"); 209 sb.append("}"); 210 return sb.toString(); 211 } 212 213 /** 214 * Convert the given object to string with each line indented by 4 spaces 215 * (except the first line). 216 */ 217 private String toIndentedString(java.lang.Object o) { 218 if (o == null) { 219 return "null"; 220 } 221 return o.toString().replace("\n", "\n "); 222 } 223 224} 225