001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.dto.swagger; 014 015import static org.apache.juneau.internal.BeanPropertyUtils.*; 016import static org.apache.juneau.internal.ArrayUtils.*; 017 018import java.util.*; 019 020import org.apache.juneau.*; 021import org.apache.juneau.annotation.*; 022 023/** 024 * Describes a single operation parameter. 025 * 026 * <p> 027 * A unique parameter is defined by a combination of a name and location. 028 * 029 * <p> 030 * There are five possible parameter types. 031 * <ul class='spaced-list'> 032 * <li><js>"path"</js> - Used together with Path Templating, where the parameter value is actually part of the 033 * operation's URL. 034 * This does not include the host or base path of the API. 035 * For example, in <code>/items/{itemId}</code>, the path parameter is <code>itemId</code>. 036 * <li><js>"query"</js> - Parameters that are appended to the URL. 037 * For example, in <code>/items?id=###</code>, the query parameter is <code>id</code>. 038 * <li><js>"header"</js> - Custom headers that are expected as part of the request. 039 * <li><js>"body"</js> - The payload that's appended to the HTTP request. 040 * Since there can only be one payload, there can only be one body parameter. 041 * The name of the body parameter has no effect on the parameter itself and is used for documentation purposes 042 * only. 043 * Since Form parameters are also in the payload, body and form parameters cannot exist together for the same 044 * operation. 045 * <li><js>"formData"</js> - Used to describe the payload of an HTTP request when either 046 * <code>application/x-www-form-urlencoded</code>, <code>multipart/form-data</code> or both are used as the 047 * content type of the request (in Swagger's definition, the consumes property of an operation). 048 * This is the only parameter type that can be used to send files, thus supporting the file type. 049 * Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the 050 * same operation. 051 * Form parameters have a different format based on the content-type used (for further details, consult 052 * <code>http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4</code>): 053 * <ul> 054 * <li><js>"application/x-www-form-urlencoded"</js> - Similar to the format of Query parameters but as a 055 * payload. 056 * For example, <code>foo=1&bar=swagger</code> - both <code>foo</code> and <code>bar</code> are form 057 * parameters. 058 * This is normally used for simple parameters that are being transferred. 059 * <li><js>"multipart/form-data"</js> - each parameter takes a section in the payload with an internal header. 060 * For example, for the header <code>Content-Disposition: form-data; name="submit-name"</code> the name of 061 * the parameter is <code>submit-name</code>. 062 * This type of form parameters is more commonly used for file transfers. 063 * </ul> 064 * </li> 065 * </ul> 066 * 067 * <h5 class='section'>Example:</h5> 068 * <p class='bcode'> 069 * <jc>// Construct using SwaggerBuilder.</jc> 070 * ParameterInfo x = <jsm>parameterInfo</jsm>(<js>"query"</js>, <js>"foo"</js>); 071 * 072 * <jc>// Serialize using JsonSerializer.</jc> 073 * String json = JsonSerializer.<jsf>DEFAULT</jsf>.toString(x); 074 * 075 * <jc>// Or just use toString() which does the same as above.</jc> 076 * String json = x.toString(); 077 * </p> 078 * <p class='bcode'> 079 * <jc>// Output</jc> 080 * { 081 * <js>"in"</js>: <js>"query"</js>, 082 * <js>"name"</js>: <js>"foo"</js> 083 * } 084 * </p> 085 * 086 * <h5 class='section'>See Also:</h5> 087 * <ul class='doctree'> 088 * <li class='link'><a class='doclink' href='../../../../../overview-summary.html#juneau-dto.Swagger'>Overview > juneau-dto > Swagger</a> 089 * </ul> 090 */ 091@Bean(properties="in,name,type,description,required,schema,format,allowEmptyValue,items,collectionFormat,default,maximum,exclusiveMaximum,minimum,exclusiveMinimum,maxLength,minLength,pattern,maxItems,minItems,uniqueItems,enum,multipleOf,*") 092public class ParameterInfo extends SwaggerElement { 093 094 private static final String[] VALID_IN = {"query", "header", "path", "formData", "body"}; 095 private static final String[] VALID_TYPES = {"string", "number", "integer", "boolean", "array", "file"}; 096 private static final String[] VALID_COLLECTION_FORMATS = {"csv", "ssv", "tsv", "pipes", "multi"}; 097 098 private String 099 name, 100 in, 101 description, 102 type, 103 format, 104 pattern, 105 collectionFormat; 106 private Number 107 maximum, 108 minimum, 109 multipleOf; 110 private Integer 111 maxLength, 112 minLength, 113 maxItems, 114 minItems; 115 private Boolean 116 required, 117 allowEmptyValue, 118 exclusiveMaximum, 119 exclusiveMinimum, 120 uniqueItems; 121 private SchemaInfo schema; 122 private Items items; 123 private Object _default; 124 private List<Object> _enum; 125 126 @Override /* SwaggerElement */ 127 protected ParameterInfo strict() { 128 super.strict(); 129 return this; 130 } 131 132 /** 133 * Copies any non-null fields from the specified object to this object. 134 * 135 * @param p 136 * The object to copy fields from. 137 * <br>Can be <jk>null</jk>. 138 * @return This object (for method chaining). 139 */ 140 public ParameterInfo copyFrom(ParameterInfo p) { 141 if (p != null) { 142 if (p.name != null) 143 name = p.name; 144 if (p.in != null) 145 in = p.in; 146 if (p.description != null) 147 description = p.description; 148 if (p.type != null) 149 type = p.type; 150 if (p.format != null) 151 format = p.format; 152 if (p.pattern != null) 153 pattern = p.pattern; 154 if (p.collectionFormat != null) 155 collectionFormat = p.collectionFormat; 156 if (p.maximum != null) 157 maximum = p.maximum; 158 if (p.minimum != null) 159 minimum = p.minimum; 160 if (p.multipleOf != null) 161 multipleOf = p.multipleOf; 162 if (p.maxLength != null) 163 maxLength = p.maxLength; 164 if (p.minLength != null) 165 minLength = p.minLength; 166 if (p.maxItems != null) 167 maxItems = p.maxItems; 168 if (p.minItems != null) 169 minItems = p.minItems; 170 if (p.required != null) 171 required = p.required; 172 if (p.allowEmptyValue != null) 173 allowEmptyValue = p.allowEmptyValue; 174 if (p.exclusiveMaximum != null) 175 exclusiveMaximum = p.exclusiveMaximum; 176 if (p.exclusiveMinimum != null) 177 exclusiveMinimum = p.exclusiveMinimum; 178 if (p.uniqueItems != null) 179 uniqueItems = p.uniqueItems; 180 if (p.schema != null) 181 schema = p.schema; 182 if (p.items != null) 183 items = p.items; 184 if (p._default != null) 185 _default = p._default; 186 if (p._enum != null) 187 _enum = p._enum; 188 } 189 return this; 190 } 191 192 /** 193 * Bean property getter: <property>name</property>. 194 * 195 * <p> 196 * The name of the parameter. 197 * 198 * <h5 class='section'>Notes:</h5> 199 * <ul class='spaced-list'> 200 * <li> 201 * Parameter names are case sensitive. 202 * <li> 203 * If <code>in</code> is <js>"path"</js>, the <code>name</code> field MUST correspond to the associated path segment 204 * from the <code>path</code> field in the <a class="doclink" href="http://swagger.io/specification/#pathsObject">Paths Object</a>. 205 * <li> 206 * For all other cases, the name corresponds to the parameter name used based on the <code>in</code> property. 207 * </ul> 208 * 209 * <h5 class='section'>See Also:</h5> 210 * <ul> 211 * <li class='extlink'><a class="doclink" href="http://swagger.io/specification/#pathTemplating">Path Templating</a> 212 * </ul> 213 * 214 * @return The property value, or <jk>null</jk> if it is not set. 215 */ 216 public String getName() { 217 return name; 218 } 219 220 /** 221 * Bean property setter: <property>name</property>. 222 * 223 * <p> 224 * The name of the parameter. 225 * 226 * <h5 class='section'>Notes:</h5> 227 * <ul class='spaced-list'> 228 * <li> 229 * Parameter names are case sensitive. 230 * <li> 231 * If <code>in</code> is <js>"path"</js>, the <code>name</code> field MUST correspond to the associated path segment 232 * from the <code>path</code> field in the <a class="doclink" href="http://swagger.io/specification/#pathsObject">Paths Object</a>. 233 * <li> 234 * For all other cases, the name corresponds to the parameter name used based on the <code>in</code> property. 235 * </ul> 236 * 237 * <h5 class='section'>See Also:</h5> 238 * <ul> 239 * <li class='extlink'><a class="doclink" href="http://swagger.io/specification/#pathTemplating">Path Templating</a> 240 * </ul> 241 * 242 * @param value 243 * The new value for this property. 244 * <br>Property value is required. 245 * @return This object (for method chaining). 246 */ 247 public ParameterInfo setName(String value) { 248 if (! "body".equals(in)) 249 name = value; 250 return this; 251 } 252 253 /** 254 * Same as {@link #setName(String)}. 255 * 256 * @param value 257 * The new value for this property. 258 * <br>Non-String values will be converted to String using <code>toString()</code>. 259 * <br>Can be <jk>null</jk> to unset the property. 260 * @return This object (for method chaining). 261 */ 262 public ParameterInfo name(Object value) { 263 return setName(toStringVal(value)); 264 } 265 266 /** 267 * Bean property getter: <property>in</property>. 268 * 269 * <p> 270 * The location of the parameter. 271 * 272 * @return The property value, or <jk>null</jk> if it is not set. 273 */ 274 public String getIn() { 275 return in; 276 } 277 278 /** 279 * Bean property setter: <property>in</property>. 280 * 281 * <p> 282 * The location of the parameter. 283 * 284 * @param value 285 * The new value for this property. 286 * <br>Valid values: 287 * <ul> 288 * <li><js>"query"</js> 289 * <li><js>"header"</js> 290 * <li><js>"path"</js> 291 * <li><js>"formData"</js> 292 * <li><js>"body"</js> 293 * </ul> 294 * <br>Property value is required. 295 * @return This object (for method chaining). 296 */ 297 public ParameterInfo setIn(String value) { 298 if (isStrict() && ! contains(value, VALID_IN)) 299 throw new FormattedRuntimeException( 300 "Invalid value passed in to setIn(String). Value=''{0}'', valid values={1}", 301 value, VALID_IN 302 ); 303 in = value; 304 if ("path".equals(value)) 305 required = true; 306 return this; 307 } 308 309 /** 310 * Same as {@link #setIn(String)}. 311 * 312 * @param value 313 * The new value for this property. 314 * <br>Non-String values will be converted to String using <code>toString()</code>. 315 * <br>Valid values: 316 * <ul> 317 * <li><js>"query"</js> 318 * <li><js>"header"</js> 319 * <li><js>"path"</js> 320 * <li><js>"formData"</js> 321 * <li><js>"body"</js> 322 * </ul> 323 * <br>Property value is required. 324 * @return This object (for method chaining). 325 */ 326 public ParameterInfo in(Object value) { 327 return setIn(toStringVal(value)); 328 } 329 330 /** 331 * Bean property getter: <property>description</property>. 332 * 333 * <p> 334 * A brief description of the parameter. 335 * <br>This could contain examples of use. 336 * 337 * @return The property value, or <jk>null</jk> if it is not set. 338 */ 339 public String getDescription() { 340 return description; 341 } 342 343 /** 344 * Bean property setter: <property>description</property>. 345 * 346 * <p> 347 * A brief description of the parameter. 348 * <br>This could contain examples of use. 349 * 350 * @param value 351 * The new value for this property. 352 * <br><a class="doclink" href="https://help.github.com/articles/github-flavored-markdown">GFM syntax</a> can be used for rich text representation. 353 * <br>Can be <jk>null</jk> to unset the property. 354 * @return This object (for method chaining). 355 */ 356 public ParameterInfo setDescription(String value) { 357 description = value; 358 return this; 359 } 360 361 /** 362 * Same as {@link #setDescription(String)}. 363 * 364 * @param value 365 * The new value for this property. 366 * <br><a class="doclink" href="https://help.github.com/articles/github-flavored-markdown">GFM syntax</a> can be used for rich text representation. 367 * <br>Non-String values will be converted to String using <code>toString()</code>. 368 * <br>Can be <jk>null</jk> to unset the property. 369 * @return This object (for method chaining). 370 */ 371 public ParameterInfo description(Object value) { 372 return setDescription(toStringVal(value)); 373 } 374 375 /** 376 * Bean property getter: <property>required</property>. 377 * 378 * <p> 379 * Determines whether this parameter is mandatory. 380 * 381 * @return The property value, or <jk>null</jk> if it is not set. 382 */ 383 public Boolean getRequired() { 384 return required; 385 } 386 387 /** 388 * Bean property setter: <property>required</property>. 389 * 390 * <p> 391 * Determines whether this parameter is mandatory. 392 * 393 * <p> 394 * 395 * @param value 396 * The new value for this property. 397 * <br>If the parameter is <code>in</code> <js>"path"</js>, this property is required and its value MUST be <jk>true</jk>. 398 * <br>Otherwise, the property MAY be included and its default value is <jk>false</jk>. 399 * <br>Can be <jk>null</jk> to unset the property. 400 * @return This object (for method chaining). 401 */ 402 public ParameterInfo setRequired(Boolean value) { 403 required = value; 404 return this; 405 } 406 407 /** 408 * Same as {@link #setRequired(Boolean)}. 409 * 410 * @param value 411 * The new value for this property. 412 * <br>Non-boolean values will be converted to boolean using <code>Boolean.<jsm>valueOf</jsm>(value.toString())</code>. 413 * <br>If the parameter is <code>in</code> <js>"path"</js>, this property is required and its value MUST be <jk>true</jk>. 414 * <br>Otherwise, the property MAY be included and its default value is <jk>false</jk>. 415 * <br>Can be <jk>null</jk> to unset the property. 416 * @return This object (for method chaining). 417 */ 418 public ParameterInfo required(Object value) { 419 return setRequired(toBoolean(value)); 420 } 421 422 /** 423 * Bean property getter: <property>schema</property>. 424 * 425 * <p> 426 * The schema defining the type used for the body parameter. 427 * 428 * @return The property value, or <jk>null</jk> if it is not set. 429 */ 430 public SchemaInfo getSchema() { 431 return schema; 432 } 433 434 /** 435 * Bean property setter: <property>schema</property>. 436 * 437 * <p> 438 * The schema defining the type used for the body parameter. 439 * 440 * @param value 441 * The new value for this property. 442 * <br>Property value is required. 443 * @return This object (for method chaining). 444 */ 445 public ParameterInfo setSchema(SchemaInfo value) { 446 schema = value; 447 return this; 448 } 449 450 /** 451 * Same as {@link #setSchema(SchemaInfo)}. 452 * 453 * @param value 454 * The new value for this property. 455 * <br>Valid types: 456 * <ul> 457 * <li>{@link SchemaInfo} 458 * <li><code>String</code> - JSON object representation of {@link SchemaInfo} 459 * <h5 class='figure'>Example:</h5> 460 * <p class='bcode'> 461 * schema(<js>"{type:'type',description:'description',...}"</js>); 462 * </p> 463 * </ul> 464 * <br>Property value is required. 465 * @return This object (for method chaining). 466 */ 467 public ParameterInfo schema(Object value) { 468 return setSchema(toType(value, SchemaInfo.class)); 469 } 470 471 /** 472 * Bean property getter: <property>type</property>. 473 * 474 * <p> 475 * The type of the parameter. 476 * 477 * @return The property value, or <jk>null</jk> if it is not set. 478 */ 479 public String getType() { 480 return type; 481 } 482 483 /** 484 * Bean property setter: <property>type</property>. 485 * 486 * <p> 487 * The type of the parameter. 488 * 489 * @param value 490 * The new value for this property. 491 * <br>Valid values: 492 * <ul> 493 * <li><js>"string"</js> 494 * <li><js>"number"</js> 495 * <li><js>"integer"</js> 496 * <li><js>"boolean"</js> 497 * <li><js>"array"</js> 498 * <li><js>"file"</js> 499 * </ul> 500 * <br>If type is <js>"file"</js>, the <code>consumes</code> MUST be either <js>"multipart/form-data"</js>, <js>"application/x-www-form-urlencoded"</js> 501 * or both and the parameter MUST be <code>in</code> <js>"formData"</js>. 502 * <br>Property value is required. 503 * @return This object (for method chaining). 504 */ 505 public ParameterInfo setType(String value) { 506 if (isStrict() && ! contains(value, VALID_TYPES)) 507 throw new FormattedRuntimeException( 508 "Invalid value passed in to setType(String). Value=''{0}'', valid values={1}", 509 value, VALID_TYPES 510 ); 511 type = value; 512 return this; 513 } 514 515 /** 516 * Same as {@link #setType(String)}. 517 * 518 * @param value 519 * The new value for this property. 520 * <br>Non-String values will be converted to String using <code>toString()</code>. 521 * <br>Valid values: 522 * <ul> 523 * <li><js>"string"</js> 524 * <li><js>"number"</js> 525 * <li><js>"integer"</js> 526 * <li><js>"boolean"</js> 527 * <li><js>"array"</js> 528 * <li><js>"file"</js> 529 * </ul> 530 * <br>If type is <js>"file"</js>, the <code>consumes</code> MUST be either <js>"multipart/form-data"</js>, <js>"application/x-www-form-urlencoded"</js> 531 * or both and the parameter MUST be <code>in</code> <js>"formData"</js>. 532 * <br>Property value is required. 533 * @return This object (for method chaining). 534 */ 535 public ParameterInfo type(Object value) { 536 return setType(toStringVal(value)); 537 } 538 539 /** 540 * Bean property getter: <property>format</property>. 541 * 542 * <p> 543 * The extending format for the previously mentioned type. 544 * 545 * <h5 class='section'>See Also:</h5> 546 * <ul> 547 * <li class='extlink'><a class="doclink" href="http://swagger.io/specification/#dataTypeFormat">Data Type Formats</a> 548 * </ul> 549 * 550 * @return The property value, or <jk>null</jk> if it is not set. 551 */ 552 public String getFormat() { 553 return format; 554 } 555 556 /** 557 * Bean property setter: <property>format</property>. 558 * 559 * <p> 560 * The extending format for the previously mentioned type. 561 * 562 * <h5 class='section'>See Also:</h5> 563 * <ul> 564 * <li class='extlink'><a class="doclink" href="http://swagger.io/specification/#dataTypeFormat">Data Type Formats</a> 565 * </ul> 566 * 567 * @param value The new value for this property. 568 * @return This object (for method chaining). 569 */ 570 public ParameterInfo setFormat(String value) { 571 format = value; 572 return this; 573 } 574 575 /** 576 * Same as {@link #setFormat(String)}. 577 * 578 * @param value 579 * The new value for this property. 580 * <br>Non-String values will be converted to String using <code>toString()</code>. 581 * <br>Can be <jk>null</jk> to unset the property. 582 * @return This object (for method chaining). 583 */ 584 public ParameterInfo format(Object value) { 585 return setFormat(toStringVal(value)); 586 } 587 588 /** 589 * Bean property getter: <property>allowEmptyValue</property>. 590 * 591 * <p> 592 * Sets the ability to pass empty-valued parameters. 593 * 594 * <p> 595 * This is valid only for either <code>query</code> or <code>formData</code> parameters and allows you to send a 596 * parameter with a name only or an empty value. 597 * 598 * @return The property value, or <jk>null</jk> if it is not set. 599 */ 600 public Boolean getAllowEmptyValue() { 601 return allowEmptyValue; 602 } 603 604 /** 605 * Bean property setter: <property>allowEmptyValue</property>. 606 * 607 * <p> 608 * Sets the ability to pass empty-valued parameters. 609 * 610 * <p> 611 * This is valid only for either <code>query</code> or <code>formData</code> parameters and allows you to send a 612 * parameter with a name only or an empty value. 613 * 614 * @param value 615 * The new value for this property. 616 * <br>Can be <jk>null</jk> to unset the property. 617 * <br>Default is <jk>false</jk>. 618 * @return This object (for method chaining). 619 */ 620 public ParameterInfo setAllowEmptyValue(Boolean value) { 621 allowEmptyValue = value; 622 return this; 623 } 624 625 /** 626 * Same as {@link #setAllowEmptyValue(Boolean)}. 627 * 628 * @param value 629 * The new value for this property. 630 * <br>Non-boolean values will be converted to boolean using <code>Boolean.<jsm>valueOf</jsm>(value.toString())</code>. 631 * <br>Can be <jk>null</jk> to unset the property. 632 * <br>Default is <jk>false</jk>. 633 * @return This object (for method chaining). 634 */ 635 public ParameterInfo allowEmptyValue(Object value) { 636 return setAllowEmptyValue(toBoolean(value)); 637 } 638 639 /** 640 * Bean property getter: <property>items</property>. 641 * 642 * <p> 643 * Describes the type of items in the array. 644 * 645 * @return The property value, or <jk>null</jk> if it is not set. 646 */ 647 public Items getItems() { 648 return items; 649 } 650 651 /** 652 * Bean property setter: <property>items</property>. 653 * 654 * <p> 655 * Describes the type of items in the array. 656 * 657 * @param value 658 * The new value for this property. 659 * <br>Property value is required if <code>type</code> is <js>"array"</js>. 660 * <br>Can be <jk>null</jk> to unset the property. 661 * @return This object (for method chaining). 662 */ 663 public ParameterInfo setItems(Items value) { 664 items = value; 665 return this; 666 } 667 668 /** 669 * Same as {@link #setItems(Items)}. 670 * 671 * @param value 672 * The new value for this property. 673 * <br>Property value is required if <code>type</code> is <js>"array"</js>. 674 * <br>Valid types: 675 * <ul> 676 * <li>{@link Items} 677 * <li><code>String</code> - JSON object representation of {@link Items} 678 * <h5 class='figure'>Example:</h5> 679 * <p class='bcode'> 680 * items(<js>"{type:'type',format:'format',...}"</js>); 681 * </p> 682 * </ul> 683 * <br>Can be <jk>null</jk> to unset the property. 684 * @return This object (for method chaining). 685 */ 686 public ParameterInfo items(Object value) { 687 return setItems(toType(value, Items.class)); 688 } 689 690 /** 691 * Bean property getter: <property>collectionFormat</property>. 692 * 693 * <p> 694 * Determines the format of the array if type array is used. 695 * 696 * @return The property value, or <jk>null</jk> if it is not set. 697 */ 698 public String getCollectionFormat() { 699 return collectionFormat; 700 } 701 702 /** 703 * Bean property setter: <property>collectionFormat</property>. 704 * 705 * <p> 706 * Determines the format of the array if type array is used. 707 * 708 * @param value 709 * The new value for this property. 710 * <br>Valid values: 711 * <ul> 712 * <li><js>"csv"</js> (default) - comma separated values <code>foo,bar</code>. 713 * <li><js>"ssv"</js> - space separated values <code>foo bar</code>. 714 * <li><js>"tsv"</js> - tab separated values <code>foo\tbar</code>. 715 * <li><js>"pipes"</js> - pipe separated values <code>foo|bar</code>. 716 * <li><js>"multi"</js> - corresponds to multiple parameter instances instead of multiple values for a single 717 * instance <code>foo=bar&foo=baz</code>. 718 * <br>This is valid only for parameters <code>in</code> <js>"query"</js> or <js>"formData"</js>. 719 * </ul> 720 * <br>Can be <jk>null</jk> to unset the property. 721 * @return This object (for method chaining). 722 */ 723 public ParameterInfo setCollectionFormat(String value) { 724 if (isStrict() && ! contains(value, VALID_COLLECTION_FORMATS)) 725 throw new FormattedRuntimeException( 726 "Invalid value passed in to setCollectionFormat(String). Value=''{0}'', valid values={1}", 727 value, VALID_COLLECTION_FORMATS 728 ); 729 collectionFormat = value; 730 return this; 731 } 732 733 /** 734 * Same as {@link #setCollectionFormat(String)}. 735 * 736 * @param value 737 * The new value for this property. 738 * <br>Non-String values will be converted to String using <code>toString()</code>. 739 * <br>Valid values: 740 * <ul> 741 * <li><js>"csv"</js> (default) - comma separated values <code>foo,bar</code>. 742 * <li><js>"ssv"</js> - space separated values <code>foo bar</code>. 743 * <li><js>"tsv"</js> - tab separated values <code>foo\tbar</code>. 744 * <li><js>"pipes"</js> - pipe separated values <code>foo|bar</code>. 745 * <li><js>"multi"</js> - corresponds to multiple parameter instances instead of multiple values for a single 746 * instance <code>foo=bar&foo=baz</code>. 747 * <br>This is valid only for parameters <code>in</code> <js>"query"</js> or <js>"formData"</js>. 748 * </ul> 749 * <br>Can be <jk>null</jk> to unset the property. 750 * @return This object (for method chaining). 751 */ 752 public ParameterInfo collectionFormat(Object value) { 753 return setCollectionFormat(toStringVal(value)); 754 } 755 756 /** 757 * Bean property getter: <property>default</property>. 758 * 759 * <p> 760 * Declares the value of the parameter that the server will use if none is provided, for example a <js>"count"</js> 761 * to control the number of results per page might default to 100 if not supplied by the client in the request. 762 * 763 * (Note: <js>"default"</js> has no meaning for required parameters.) 764 * Unlike JSON Schema this value MUST conform to the defined <code>type</code> for this parameter. 765 * 766 * <h5 class='section'>See Also:</h5> 767 * <ul> 768 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor101">http://json-schema.org/latest/json-schema-validation.html#anchor101</a> 769 * </ul> 770 * 771 * @return The property value, or <jk>null</jk> if it is not set. 772 */ 773 public Object getDefault() { 774 return _default; 775 } 776 777 /** 778 * Bean property setter: <property>default</property>. 779 * 780 * <p> 781 * Declares the value of the parameter that the server will use if none is provided, for example a <js>"count"</js> 782 * to control the number of results per page might default to 100 if not supplied by the client in the request. 783 * (Note: <js>"default"</js> has no meaning for required parameters.) 784 * Unlike JSON Schema this value MUST conform to the defined <code>type</code> for this parameter. 785 * 786 * <h5 class='section'>See Also:</h5> 787 * <ul> 788 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor101">http://json-schema.org/latest/json-schema-validation.html#anchor101</a> 789 * </ul> 790 * 791 * @param value The new value for this property. 792 * @return This object (for method chaining). 793 */ 794 public ParameterInfo setDefault(Object value) { 795 _default = value; 796 return this; 797 } 798 799 /** 800 * Same as {@link #setDefault(Object)}. 801 * 802 * @param value The new value for this property. 803 * @return This object (for method chaining). 804 */ 805 public ParameterInfo _default(Object value) { 806 return setDefault(value); 807 } 808 809 /** 810 * Bean property getter: <property>maximum</property>. 811 * 812 * <h5 class='section'>See Also:</h5> 813 * <ul> 814 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor17">http://json-schema.org/latest/json-schema-validation.html#anchor17</a> 815 * </ul> 816 * 817 * @return The property value, or <jk>null</jk> if it is not set. 818 */ 819 public Number getMaximum() { 820 return maximum; 821 } 822 823 /** 824 * Bean property setter: <property>maximum</property>. 825 * 826 * <h5 class='section'>See Also:</h5> 827 * <ul> 828 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor17">http://json-schema.org/latest/json-schema-validation.html#anchor17</a> 829 * </ul> 830 * 831 * @param value The new value for this property. 832 * @return This object (for method chaining). 833 */ 834 public ParameterInfo setMaximum(Number value) { 835 maximum = value; 836 return this; 837 } 838 839 /** 840 * Same as {@link #setMaximum(Number)}. 841 * 842 * @param value 843 * The new value for this property. 844 * <br>Non-Number values will be converted to Number using <code>toString()</code> then best number match. 845 * <br>Can be <jk>null</jk> to unset the property. 846 * @return This object (for method chaining). 847 */ 848 public ParameterInfo maximum(Object value) { 849 return setMaximum(toNumber(value)); 850 } 851 852 /** 853 * Bean property getter: <property>exclusiveMaximum</property>. 854 * 855 * <h5 class='section'>See Also:</h5> 856 * <ul> 857 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor17">http://json-schema.org/latest/json-schema-validation.html#anchor17</a> 858 * </ul> 859 * 860 * @return The property value, or <jk>null</jk> if it is not set. 861 */ 862 public Boolean getExclusiveMaximum() { 863 return exclusiveMaximum; 864 } 865 866 /** 867 * Bean property setter: <property>exclusiveMaximum</property>. 868 * 869 * <h5 class='section'>See Also:</h5> 870 * <ul> 871 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor17">http://json-schema.org/latest/json-schema-validation.html#anchor17</a> 872 * </ul> 873 * 874 * @param value The new value for this property. 875 * @return This object (for method chaining). 876 */ 877 public ParameterInfo setExclusiveMaximum(Boolean value) { 878 exclusiveMaximum = value; 879 return this; 880 } 881 882 /** 883 * Same as {@link #setExclusiveMaximum(Boolean)}. 884 * 885 * @param value 886 * The new value for this property. 887 * <br>Non-boolean values will be converted to boolean using <code>Boolean.<jsm>valueOf</jsm>(value.toString())</code>. 888 * <br>Can be <jk>null</jk> to unset the property. 889 * @return This object (for method chaining). 890 */ 891 public ParameterInfo exclusiveMaximum(Object value) { 892 return setExclusiveMaximum(toBoolean(value)); 893 } 894 895 /** 896 * Bean property getter: <property>minimum</property>. 897 * 898 * <h5 class='section'>See Also:</h5> 899 * <ul> 900 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor21">http://json-schema.org/latest/json-schema-validation.html#anchor21</a> 901 * </ul> 902 * 903 * @return The property value, or <jk>null</jk> if it is not set. 904 */ 905 public Number getMinimum() { 906 return minimum; 907 } 908 909 /** 910 * Bean property setter: <property>minimum</property>. 911 * 912 * <h5 class='section'>See Also:</h5> 913 * <ul> 914 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor21">http://json-schema.org/latest/json-schema-validation.html#anchor21</a> 915 * </ul> 916 * 917 * @param value The new value for this property. 918 * @return This object (for method chaining). 919 */ 920 public ParameterInfo setMinimum(Number value) { 921 minimum = value; 922 return this; 923 } 924 925 /** 926 * Same as {@link #setMinimum(Number)}. 927 * 928 * @param value 929 * The new value for this property. 930 * <br>Non-Number values will be converted to Number using <code>toString()</code> then best number match. 931 * <br>Can be <jk>null</jk> to unset the property. 932 * @return This object (for method chaining). 933 */ 934 public ParameterInfo minimum(Object value) { 935 return setMinimum(toNumber(value)); 936 } 937 938 /** 939 * Bean property getter: <property>exclusiveMinimum</property>. 940 * 941 * <h5 class='section'>See Also:</h5> 942 * <ul> 943 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor21">http://json-schema.org/latest/json-schema-validation.html#anchor21</a> 944 * </ul> 945 * 946 * @return The property value, or <jk>null</jk> if it is not set. 947 */ 948 public Boolean getExclusiveMinimum() { 949 return exclusiveMinimum; 950 } 951 952 /** 953 * Bean property setter: <property>exclusiveMinimum</property>. 954 * 955 * <h5 class='section'>See Also:</h5> 956 * <ul> 957 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor21">http://json-schema.org/latest/json-schema-validation.html#anchor21</a> 958 * </ul> 959 * 960 * @param value The new value for this property. 961 * @return This object (for method chaining). 962 */ 963 public ParameterInfo setExclusiveMinimum(Boolean value) { 964 exclusiveMinimum = value; 965 return this; 966 } 967 968 /** 969 * Same as {@link #setExclusiveMinimum(Boolean)}. 970 * 971 * @param value 972 * The new value for this property. 973 * <br>Non-boolean values will be converted to boolean using <code>Boolean.<jsm>valueOf</jsm>(value.toString())</code>. 974 * <br>Can be <jk>null</jk> to unset the property. 975 * @return This object (for method chaining). 976 */ 977 public ParameterInfo exclusiveMinimum(Object value) { 978 return setExclusiveMinimum(toBoolean(value)); 979 } 980 981 /** 982 * Bean property getter: <property>maxLength</property>. 983 * 984 * <h5 class='section'>See Also:</h5> 985 * <ul> 986 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor26">http://json-schema.org/latest/json-schema-validation.html#anchor26</a> 987 * </ul> 988 * 989 * @return The property value, or <jk>null</jk> if it is not set. 990 */ 991 public Integer getMaxLength() { 992 return maxLength; 993 } 994 995 /** 996 * Bean property setter: <property>maxLength</property>. 997 * 998 * <h5 class='section'>See Also:</h5> 999 * <ul> 1000 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor26">http://json-schema.org/latest/json-schema-validation.html#anchor26</a> 1001 * </ul> 1002 * 1003 * @param value The new value for this property. 1004 * @return This object (for method chaining). 1005 */ 1006 public ParameterInfo setMaxLength(Integer value) { 1007 maxLength = value; 1008 return this; 1009 } 1010 1011 /** 1012 * Same as {@link #setMaxLength(Integer)}. 1013 * 1014 * @param value 1015 * The new value for this property. 1016 * <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>. 1017 * <br>Can be <jk>null</jk> to unset the property. 1018 * @return This object (for method chaining). 1019 */ 1020 public ParameterInfo maxLength(Object value) { 1021 return setMaxLength(toInteger(value)); 1022 } 1023 1024 /** 1025 * Bean property getter: <property>minLength</property>. 1026 * 1027 * <h5 class='section'>See Also:</h5> 1028 * <ul> 1029 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor29">http://json-schema.org/latest/json-schema-validation.html#anchor29</a> 1030 * </ul> 1031 * 1032 * @return The property value, or <jk>null</jk> if it is not set. 1033 */ 1034 public Integer getMinLength() { 1035 return minLength; 1036 } 1037 1038 /** 1039 * Bean property setter: <property>minLength</property>. 1040 * 1041 * <h5 class='section'>See Also:</h5> 1042 * <ul> 1043 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor29">http://json-schema.org/latest/json-schema-validation.html#anchor29</a> 1044 * </ul> 1045 * 1046 * @param value The new value for this property. 1047 * @return This object (for method chaining). 1048 */ 1049 public ParameterInfo setMinLength(Integer value) { 1050 minLength = value; 1051 return this; 1052 } 1053 1054 /** 1055 * Same as {@link #setMinLength(Integer)}. 1056 * 1057 * @param value 1058 * The new value for this property. 1059 * <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>. 1060 * <br>Can be <jk>null</jk> to unset the property. 1061 * @return This object (for method chaining). 1062 */ 1063 public ParameterInfo minLength(Object value) { 1064 return setMinLength(toInteger(value)); 1065 } 1066 1067 /** 1068 * Bean property getter: <property>pattern</property>. 1069 * 1070 * <h5 class='section'>See Also:</h5> 1071 * <ul> 1072 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor33">http://json-schema.org/latest/json-schema-validation.html#anchor33</a> 1073 * </ul> 1074 * 1075 * @return The property value, or <jk>null</jk> if it is not set. 1076 */ 1077 public String getPattern() { 1078 return pattern; 1079 } 1080 1081 /** 1082 * Bean property setter: <property>pattern</property>. 1083 * 1084 * <h5 class='section'>See Also:</h5> 1085 * <ul> 1086 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor33">http://json-schema.org/latest/json-schema-validation.html#anchor33</a> 1087 * </ul> 1088 * 1089 * @param value The new value for this property. 1090 * @return This object (for method chaining). 1091 */ 1092 public ParameterInfo setPattern(String value) { 1093 pattern = value; 1094 return this; 1095 } 1096 1097 /** 1098 * Same as {@link #setPattern(String)}. 1099 * 1100 * @param value 1101 * The new value for this property. 1102 * <br>Non-String values will be converted to String using <code>toString()</code>. 1103 * <br>Can be <jk>null</jk> to unset the property. 1104 * @return This object (for method chaining). 1105 */ 1106 public ParameterInfo pattern(Object value) { 1107 return setPattern(toStringVal(value)); 1108 } 1109 1110 /** 1111 * Bean property getter: <property>maxItems</property>. 1112 * 1113 * <h5 class='section'>See Also:</h5> 1114 * <ul> 1115 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor42">http://json-schema.org/latest/json-schema-validation.html#anchor42</a> 1116 * </ul> 1117 * 1118 * @return The property value, or <jk>null</jk> if it is not set. 1119 */ 1120 public Integer getMaxItems() { 1121 return maxItems; 1122 } 1123 1124 /** 1125 * Bean property setter: <property>maxItems</property>. 1126 * 1127 * <h5 class='section'>See Also:</h5> 1128 * <ul> 1129 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor42">http://json-schema.org/latest/json-schema-validation.html#anchor42</a> 1130 * </ul> 1131 * 1132 * @param value The new value for this property. 1133 * @return This object (for method chaining). 1134 */ 1135 public ParameterInfo setMaxItems(Integer value) { 1136 maxItems = value; 1137 return this; 1138 } 1139 1140 /** 1141 * Same as {@link #setMaxItems(Integer)}. 1142 * 1143 * @param value 1144 * The new value for this property. 1145 * <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>. 1146 * <br>Can be <jk>null</jk> to unset the property. 1147 * @return This object (for method chaining). 1148 */ 1149 public ParameterInfo maxItems(Object value) { 1150 return setMaxItems(toInteger(value)); 1151 } 1152 1153 /** 1154 * Bean property getter: <property>minItems</property>. 1155 * 1156 * <h5 class='section'>See Also:</h5> 1157 * <ul> 1158 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor45">http://json-schema.org/latest/json-schema-validation.html#anchor45</a> 1159 * </ul> 1160 * 1161 * @return The property value, or <jk>null</jk> if it is not set. 1162 */ 1163 public Integer getMinItems() { 1164 return minItems; 1165 } 1166 1167 /** 1168 * Bean property setter: <property>minItems</property>. 1169 * 1170 * <h5 class='section'>See Also:</h5> 1171 * <ul> 1172 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor45">http://json-schema.org/latest/json-schema-validation.html#anchor45</a> 1173 * </ul> 1174 * 1175 * @param value The new value for this property. 1176 * @return This object (for method chaining). 1177 */ 1178 public ParameterInfo setMinItems(Integer value) { 1179 minItems = value; 1180 return this; 1181 } 1182 1183 /** 1184 * Same as {@link #setMinItems(Integer)}. 1185 * 1186 * @param value 1187 * The new value for this property. 1188 * <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>. 1189 * <br>Can be <jk>null</jk> to unset the property. 1190 * @return This object (for method chaining). 1191 */ 1192 public ParameterInfo minItems(Object value) { 1193 return setMinItems(toInteger(value)); 1194 } 1195 1196 /** 1197 * Bean property getter: <property>uniqueItems</property>. 1198 * 1199 * <h5 class='section'>See Also:</h5> 1200 * <ul> 1201 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor49">http://json-schema.org/latest/json-schema-validation.html#anchor49</a> 1202 * </ul> 1203 * 1204 * @return The property value, or <jk>null</jk> if it is not set. 1205 */ 1206 public Boolean getUniqueItems() { 1207 return uniqueItems; 1208 } 1209 1210 /** 1211 * Bean property setter: <property>uniqueItems</property>. 1212 * 1213 * <h5 class='section'>See Also:</h5> 1214 * <ul> 1215 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor49">http://json-schema.org/latest/json-schema-validation.html#anchor49</a> 1216 * </ul> 1217 * 1218 * @param value The new value for this property. 1219 * @return This object (for method chaining). 1220 */ 1221 public ParameterInfo setUniqueItems(Boolean value) { 1222 uniqueItems = value; 1223 return this; 1224 } 1225 1226 /** 1227 * Same as {@link #setUniqueItems(Boolean)}. 1228 * 1229 * @param value 1230 * The new value for this property. 1231 * <br>Non-boolean values will be converted to boolean using <code>Boolean.<jsm>valueOf</jsm>(value.toString())</code>. 1232 * <br>Can be <jk>null</jk> to unset the property. 1233 * @return This object (for method chaining). 1234 */ 1235 public ParameterInfo uniqueItems(Object value) { 1236 return setUniqueItems(toBoolean(value)); 1237 } 1238 1239 /** 1240 * Bean property getter: <property>enum</property>. 1241 * 1242 * <h5 class='section'>See Also:</h5> 1243 * <ul> 1244 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor76">http://json-schema.org/latest/json-schema-validation.html#anchor76</a> 1245 * </ul> 1246 * 1247 * @return The property value, or <jk>null</jk> if it is not set. 1248 */ 1249 public List<Object> getEnum() { 1250 return _enum; 1251 } 1252 1253 /** 1254 * Bean property setter: <property>enum</property>. 1255 * 1256 * <h5 class='section'>See Also:</h5> 1257 * <ul> 1258 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor76">http://json-schema.org/latest/json-schema-validation.html#anchor76</a> 1259 * </ul> 1260 * 1261 * @param value 1262 * The new value for this property. 1263 * <br>Can be <jk>null</jk> to unset the property. 1264 * @return This object (for method chaining). 1265 */ 1266 public ParameterInfo setEnum(Collection<Object> value) { 1267 _enum = newList(value); 1268 return this; 1269 } 1270 1271 /** 1272 * Adds one or more values to the <property>enum</property> property. 1273 * 1274 * @param value 1275 * The values to add to this property. 1276 * <br>Ignored if <jk>null</jk>. 1277 * @return This object (for method chaining). 1278 */ 1279 public ParameterInfo addEnum(Collection<Object> value) { 1280 _enum = addToList(_enum, value); 1281 return this; 1282 } 1283 1284 /** 1285 * Adds one or more values to the <property>enum</property> property. 1286 * 1287 * @param values 1288 * The values to add to this property. 1289 * <br>Valid types: 1290 * <ul> 1291 * <li><code>Object</code> 1292 * <li><code>Collection<Object></code> 1293 * <li><code>String</code> - JSON array representation of <code>Collection<Object></code> 1294 * <h5 class='figure'>Example:</h5> 1295 * <p class='bcode'> 1296 * _enum(<js>"['foo','bar']"</js>); 1297 * </p> 1298 * <li><code>String</code> - Individual values 1299 * <h5 class='figure'>Example:</h5> 1300 * <p class='bcode'> 1301 * _enum(<js>"foo"</js>, <js>"bar"</js>); 1302 * </p> 1303 * </ul> 1304 * <br>Ignored if <jk>null</jk>. 1305 * @return This object (for method chaining). 1306 */ 1307 public ParameterInfo _enum(Object...values) { 1308 _enum = addToList(_enum, values, Object.class); 1309 return this; 1310 } 1311 1312 /** 1313 * Bean property getter: <property>multipleOf</property>. 1314 * 1315 * <h5 class='section'>See Also:</h5> 1316 * <ul> 1317 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor14">http://json-schema.org/latest/json-schema-validation.html#anchor14</a> 1318 * </ul> 1319 * 1320 * @return The property value, or <jk>null</jk> if it is not set. 1321 */ 1322 public Number getMultipleOf() { 1323 return multipleOf; 1324 } 1325 1326 /** 1327 * Bean property setter: <property>multipleOf</property>. 1328 * 1329 * <h5 class='section'>See Also:</h5> 1330 * <ul> 1331 * <li class='extlink'><a class="doclink" href="http://json-schema.org/latest/json-schema-validation.html#anchor14">http://json-schema.org/latest/json-schema-validation.html#anchor14</a> 1332 * </ul> 1333 * 1334 * @param value 1335 * The new value for this property. 1336 * <br>Can be <jk>null</jk> to unset the property. 1337 * @return This object (for method chaining). 1338 */ 1339 public ParameterInfo setMultipleOf(Number value) { 1340 multipleOf = value; 1341 return this; 1342 } 1343 1344 /** 1345 * Same as {@link #setMultipleOf(Number)}. 1346 * 1347 * @param value 1348 * The new value for this property. 1349 * <br>Non-Number values will be converted to Number using <code>toString()</code> then best number match. 1350 * <br>Can be <jk>null</jk> to unset the property. 1351 * @return This object (for method chaining). 1352 */ 1353 public ParameterInfo multipleOf(Object value) { 1354 return setMultipleOf(toNumber(value)); 1355 } 1356 1357 @Override /* SwaggerElement */ 1358 public <T> T get(String property, Class<T> type) { 1359 if (property == null) 1360 return null; 1361 switch (property) { 1362 case "name": return toType(getName(), type); 1363 case "in": return toType(getIn(), type); 1364 case "description": return toType(getDescription(), type); 1365 case "required": return toType(getRequired(), type); 1366 case "schema": return toType(getSchema(), type); 1367 case "type": return toType(getType(), type); 1368 case "format": return toType(getFormat(), type); 1369 case "allowEmptyValue": return toType(getAllowEmptyValue(), type); 1370 case "items": return toType(getItems(), type); 1371 case "collectionFormat": return toType(getCollectionFormat(), type); 1372 case "default": return toType(getDefault(), type); 1373 case "maximum": return toType(getMaximum(), type); 1374 case "exclusiveMaximum": return toType(getExclusiveMaximum(), type); 1375 case "minimum": return toType(getMinimum(), type); 1376 case "exclusiveMinimum": return toType(getExclusiveMinimum(), type); 1377 case "maxLength": return toType(getMaxLength(), type); 1378 case "minLength": return toType(getMinLength(), type); 1379 case "pattern": return toType(getPattern(), type); 1380 case "maxItems": return toType(getMaxItems(), type); 1381 case "minItems": return toType(getMinItems(), type); 1382 case "uniqueItems": return toType(getUniqueItems(), type); 1383 case "enum": return toType(getEnum(), type); 1384 case "multipleOf": return toType(getMultipleOf(), type); 1385 default: return super.get(property, type); 1386 } 1387 } 1388 1389 @Override /* SwaggerElement */ 1390 public ParameterInfo set(String property, Object value) { 1391 if (property == null) 1392 return this; 1393 switch (property) { 1394 case "name": return name(value); 1395 case "in": return in(value); 1396 case "description": return description(value); 1397 case "required": return required(value); 1398 case "schema": return schema(value); 1399 case "type": return type(value); 1400 case "format": return format(value); 1401 case "allowEmptyValue": return allowEmptyValue(value); 1402 case "items": return items(value); 1403 case "collectionFormat": return collectionFormat(value); 1404 case "default": return _default(value); 1405 case "maximum": return maximum(value); 1406 case "exclusiveMaximum": return exclusiveMaximum(value); 1407 case "minimum": return minimum(value); 1408 case "exclusiveMinimum": return exclusiveMinimum(value); 1409 case "maxLength": return maxLength(value); 1410 case "minLength": return minLength(value); 1411 case "pattern": return pattern(value); 1412 case "maxItems": return maxItems(value); 1413 case "minItems": return minItems(value); 1414 case "uniqueItems": return uniqueItems(value); 1415 case "enum": return setEnum(null)._enum(value); 1416 case "multipleOf": return multipleOf(value); 1417 default: 1418 super.set(property, value); 1419 return this; 1420 } 1421 } 1422}