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 HTTP header.
025 * 
026 * <h5 class='section'>Example:</h5>
027 * <p class='bcode'>
028 *    <jc>// Construct using SwaggerBuilder.</jc>
029 *    HeaderInfo x = <jsm>headerInfo</jsm>(<js>"integer"</js>).description(<js>"The number of allowed requests in the current period"</js>);
030 * 
031 *    <jc>// Serialize using JsonSerializer.</jc>
032 *    String json = JsonSerializer.<jsf>DEFAULT</jsf>.toString(x);
033 * 
034 *    <jc>// Or just use toString() which does the same as above.</jc>
035 *    String json = x.toString();
036 * </p>
037 * <p class='bcode'>
038 *    <jc>// Output</jc>
039 *    {
040 *       <js>"description"</js>: <js>"The number of allowed requests in the current period"</js>,
041 *       <js>"type"</js>: <js>"integer"</js>
042 *    }
043 * </p>
044 * 
045 * <h5 class='section'>See Also:</h5>
046 * <ul class='doctree'>
047 *    <li class='link'><a class='doclink' href='../../../../../overview-summary.html#juneau-dto.Swagger'>Overview &gt; juneau-dto &gt; Swagger</a>
048 * </ul>
049 */
050@Bean(properties="description,type,format,items,collectionFormat,default,maximum,exclusiveMaximum,minimum,exclusiveMinimum,maxLength,minLength,pattern,maxItems,minItems,uniqueItems,enum,multipleOf,*")
051@SuppressWarnings({"unchecked"})
052public class HeaderInfo extends SwaggerElement {
053
054   private static final String[] VALID_TYPES = {"string", "number", "integer", "boolean", "array"};
055   private static final String[] VALID_COLLECTION_FORMATS = {"csv","ssv","tsv","pipes","multi"};
056
057   private String 
058      description,
059      type,
060      format,
061      collectionFormat,
062      pattern;
063   private Number 
064      maximum,
065      minimum,
066      multipleOf;
067   private Integer 
068      maxLength,
069      minLength,
070      maxItems,
071      minItems;
072   private Boolean 
073      exclusiveMaximum,
074      exclusiveMinimum,
075      uniqueItems;
076   private Items items;
077   private Object _default;
078   private List<Object> _enum;
079
080   @Override /* SwaggerElement */
081   protected HeaderInfo strict() {
082      super.strict();
083      return this;
084   }
085
086   /**
087    * Bean property getter:  <property>description</property>.
088    * 
089    * <p>
090    * A short description of the header.
091    * 
092    * @return The property value, or <jk>null</jk> if it is not set.
093    */
094   public String getDescription() {
095      return description;
096   }
097
098   /**
099    * Bean property setter:  <property>description</property>.
100    * 
101    * <p>
102    * A short description of the header.
103    * 
104    * @param value 
105    *    The new value for this property.
106    *    <br>Can be <jk>null</jk> to unset the property.
107    * @return This object (for method chaining).
108    */
109   public HeaderInfo setDescription(String value) {
110      description = value;
111      return this;
112   }
113
114   /**
115    * Same as {@link #setDescription(String)}.
116    * 
117    * @param value
118    *    The new value for this property.
119    *    <br>Non-String values will be converted to String using <code>toString()</code>.
120    *    <br>Can be <jk>null</jk> to unset the property.
121    * @return This object (for method chaining).
122    */
123   public HeaderInfo description(Object value) {
124      return setDescription(toStringVal(value));
125   }
126
127   /**
128    * Bean property getter:  <property>type</property>.
129    * 
130    * <p>
131    * The type of the object.
132    * 
133    * @return The property value, or <jk>null</jk> if it is not set.
134    */
135   public String getType() {
136      return type;
137   }
138
139   /**
140    * Bean property setter:  <property>type</property>.
141    * 
142    * <p>
143    * The type of the object.
144    * 
145    * @param value 
146    *    The new value for this property.
147    *    <br>Property value is required.
148    *    <br>Valid values:
149    *    <ul>
150    *       <li><js>"string"</js>
151    *       <li><js>"number"</js>
152    *       <li><js>"integer"</js>
153    *       <li><js>"boolean"</js>
154    *       <li><js>"array"</js>
155    *    </ul>
156    * @return This object (for method chaining).
157    */
158   public HeaderInfo setType(String value) {
159      if (isStrict() && ! contains(value, VALID_TYPES))
160         throw new FormattedRuntimeException(
161            "Invalid value passed in to setType(String).  Value=''{0}'', valid values={1}",
162            value, VALID_TYPES
163         );
164      type = value;
165      return this;
166   }
167
168   /**
169    * Same as {@link #setType(String)}.
170    * 
171    * @param value
172    *    The new value for this property.
173    *    <br>Non-String values will be converted to String using <code>toString()</code>.
174    *    <br>Can be <jk>null</jk> to unset the property.
175    * @return This object (for method chaining).
176    */
177   public HeaderInfo type(Object value) {
178      return setType(toStringVal(value));
179   }
180
181   /**
182    * Bean property getter:  <property>format</property>.
183    * 
184    * <p>
185    * The extending format for the previously mentioned <code>type</code>.
186    * 
187    * <h5 class='section'>See Also:</h5>
188    * <ul>
189    *    <li class='extlink'><a class="doclink" href="http://swagger.io/specification/#dataTypeFormat">Data Type Formats</a>
190    * </ul>
191    * 
192    * @return The property value, or <jk>null</jk> if it is not set.
193    */
194   public String getFormat() {
195      return format;
196   }
197
198   /**
199    * Bean property setter:  <property>format</property>.
200    * 
201    * <p>
202    * The extending format for the previously mentioned <code>type</code>.
203    * 
204    * <h5 class='section'>See Also:</h5>
205    * <ul>
206    *    <li class='extlink'><a class="doclink" href="http://swagger.io/specification/#dataTypeFormat">Data Type Formats</a>
207    * </ul>
208    * 
209    * @param value 
210    *    The new value for this property.
211    *    <br>Can be <jk>null</jk> to unset the property.
212    * @return This object (for method chaining).
213    */
214   public HeaderInfo setFormat(String value) {
215      format = value;
216      return this;
217   }
218
219   /**
220    * Same as {@link #setFormat(String)}.
221    * 
222    * @param value
223    *    The new value for this property.
224    *    <br>Non-String values will be converted to String using <code>toString()</code>.
225    *    <br>Can be <jk>null</jk> to unset the property.
226    * @return This object (for method chaining).
227    */
228   public HeaderInfo format(Object value) {
229      return setFormat(toStringVal(value));
230   }
231
232   /**
233    * Bean property getter:  <property>items</property>.
234    * 
235    * <p>
236    * Describes the type of items in the array.
237    * 
238    * @return The property value, or <jk>null</jk> if it is not set.
239    */
240   public Items getItems() {
241      return items;
242   }
243
244   /**
245    * Bean property setter:  <property>items</property>.
246    * 
247    * <p>
248    * Describes the type of items in the array.
249    * 
250    * @param value 
251    *    The new value for this property.
252    *    <br>Property value is required if <code>type</code> is <js>"array"</js>.
253    *    <br>Can be <jk>null</jk> to unset the property.
254    * @return This object (for method chaining).
255    */
256   public HeaderInfo setItems(Items value) {
257      items = value;
258      return this;
259   }
260
261   /**
262    * Same as {@link #setItems(Items)}.
263    * 
264    * @param value 
265    *    The new value for this property.
266    *    <br>Valid types:
267    *    <ul>
268    *       <li>{@link Items}
269    *       <li><code>String</code> - JSON object representation of {@link Items}
270    *          <h5 class='figure'>Example:</h5>
271    *          <p class='bcode'>
272    *    items(<js>"{type:'type',format:'format',...}"</js>);
273    *          </p>
274    *    </ul>
275    *    <br>Can be <jk>null</jk> to unset the property.
276    * @return This object (for method chaining).
277    */
278   public HeaderInfo items(Object value) {
279      return setItems(toType(value, Items.class));
280   }
281
282   /**
283    * Bean property getter:  <property>collectionFormat</property>.
284    * 
285    * <p>
286    * Determines the format of the array if type array is used.
287    * 
288    * @return The property value, or <jk>null</jk> if it is not set.
289    */
290   public String getCollectionFormat() {
291      return collectionFormat;
292   }
293
294   /**
295    * Bean property setter:  <property>collectionFormat</property>.
296    * 
297    * <p>
298    * Determines the format of the array if type array is used.
299    * 
300    * @param value 
301    *    The new value for this property.
302    *    <br>Valid values:
303    *    <ul>
304    *       <li><js>"csv"</js> (default) - comma separated values <code>foo,bar</code>.
305    *       <li><js>"ssv"</js> - space separated values <code>foo bar</code>.
306    *       <li><js>"tsv"</js> - tab separated values <code>foo\tbar</code>.
307    *       <li><js>"pipes"</js> - pipe separated values <code>foo|bar</code>.
308    *    </ul>
309    * @return This object (for method chaining).
310    */
311   public HeaderInfo setCollectionFormat(String value) {
312      if (isStrict() && ! contains(value, VALID_COLLECTION_FORMATS))
313         throw new FormattedRuntimeException(
314            "Invalid value passed in to setCollectionFormat(String).  Value=''{0}'', valid values={1}",
315            value, VALID_COLLECTION_FORMATS
316         );
317      collectionFormat = value;
318      return this;
319   }
320
321   /**
322    * Same as {@link #setCollectionFormat(String)}.
323    * 
324    * @param value
325    *    The new value for this property.
326    *    <br>Non-String values will be converted to String using <code>toString()</code>.
327    *    <br>Can be <jk>null</jk> to unset the property.
328    * @return This object (for method chaining).
329    */
330   public HeaderInfo collectionFormat(Object value) {
331      return setCollectionFormat(toStringVal(value));
332   }
333
334   /**
335    * Bean property getter:  <property>default</property>.
336    * 
337    * <p>
338    * Declares the value of the header that the server will use if none is provided.
339    * 
340    * <h5 class='section'>Notes:</h5>
341    * <ul class='spaced-list'>
342    *    <li>
343    *       <js>"default"</js> has no meaning for required items.
344    *    <li>
345    *       Unlike JSON Schema this value MUST conform to the defined <code>type</code> for the header.
346    * </ul>
347    * 
348    * <h5 class='section'>See Also:</h5>
349    * <ul>
350    *    <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>
351    * </ul>
352    * 
353    * @return The property value, or <jk>null</jk> if it is not set.
354    */
355   public Object getDefault() {
356      return _default;
357   }
358
359   /**
360    * Bean property setter:  <property>default</property>.
361    * 
362    * <p>
363    * Declares the value of the header that the server will use if none is provided.
364    * 
365    * <h5 class='section'>Notes:</h5>
366    * <ul class='spaced-list'>
367    *    <li>
368    *       <js>"default"</js> has no meaning for required items.
369    *    <li>
370    *       Unlike JSON Schema this value MUST conform to the defined <code>type</code> for the header.
371    * </ul>
372    * 
373    * <h5 class='section'>See Also:</h5>
374    * <ul>
375    *    <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>
376    * </ul>
377    * 
378    * @param value 
379    *    The new value for this property.
380    *    <br>Can be <jk>null</jk> to unset the property.
381    * @return This object (for method chaining).
382    */
383   public HeaderInfo setDefault(Object value) {
384      _default = value;
385      return this;
386   }
387
388   /**
389    * Same as {@link #setDefault(Object)}.
390    * 
391    * @param value The new value for this property.
392    * @return This object (for method chaining).
393    */
394   public HeaderInfo _default(Object value) {
395      return setDefault(value);
396   }
397
398   /**
399    * Bean property getter:  <property>maximum</property>.
400    * 
401    * <h5 class='section'>See Also:</h5>
402    * <ul>
403    *    <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>
404    * </ul>
405    * 
406    * @return The property value, or <jk>null</jk> if it is not set.
407    */
408   public Number getMaximum() {
409      return maximum;
410   }
411
412   /**
413    * Bean property setter:  <property>maximum</property>.
414    * 
415    * <h5 class='section'>See Also:</h5>
416    * <ul>
417    *    <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>
418    * </ul>
419    * 
420    * @param value 
421    *    The new value for this property.
422    *    <br>Can be <jk>null</jk> to unset the property.
423    * @return This object (for method chaining).
424    */
425   public HeaderInfo setMaximum(Number value) {
426      maximum = value;
427      return this;
428   }
429
430   /**
431    * Same as {@link #setMaximum(Number)}.
432    * 
433    * @param value
434    *    The new value for this property.
435    *    <br>Non-Number values will be converted to Number using <code>toString()</code> then best number match.
436    *    <br>Can be <jk>null</jk> to unset the property.
437    * @return This object (for method chaining).
438    */
439   public HeaderInfo maximum(Object value) {
440      return setMaximum(toNumber(value));
441   }
442
443   /**
444    * Bean property getter:  <property>exclusiveMaximum</property>.
445    * 
446    * <h5 class='section'>See Also:</h5>
447    * <ul>
448    *    <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>
449    * </ul>
450    * 
451    * @return The property value, or <jk>null</jk> if it is not set.
452    */
453   public Boolean getExclusiveMaximum() {
454      return exclusiveMaximum;
455   }
456
457   /**
458    * Bean property setter:  <property>exclusiveMaximum</property>.
459    * 
460    * <h5 class='section'>See Also:</h5>
461    * <ul>
462    *    <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>
463    * </ul>
464    * 
465    * @param value 
466    *    The new value for this property.
467    *    <br>Can be <jk>null</jk> to unset the property.
468    * @return This object (for method chaining).
469    */
470   public HeaderInfo setExclusiveMaximum(Boolean value) {
471      exclusiveMaximum = value;
472      return this;
473   }
474
475   /**
476    * Same as {@link #setExclusiveMaximum(Boolean)}.
477    * 
478    * @param value
479    *    The new value for this property.
480    *    <br>Non-boolean values will be converted to boolean using <code>Boolean.<jsm>valueOf</jsm>(value.toString())</code>.
481    *    <br>Can be <jk>null</jk> to unset the property.
482    * @return This object (for method chaining).
483    */
484   public HeaderInfo exclusiveMaximum(Object value) {
485      return setExclusiveMaximum(toBoolean(value));
486   }
487
488   /**
489    * Bean property getter:  <property>minimum</property>.
490    * 
491    * <h5 class='section'>See Also:</h5>
492    * <ul>
493    *    <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>
494    * </ul>
495    * 
496    * @return The property value, or <jk>null</jk> if it is not set.
497    */
498   public Number getMinimum() {
499      return minimum;
500   }
501
502   /**
503    * Bean property setter:  <property>minimum</property>.
504    * 
505    * <h5 class='section'>See Also:</h5>
506    * <ul>
507    *    <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>
508    * </ul>
509    * 
510    * @param value 
511    *    The new value for this property.
512    *    <br>Can be <jk>null</jk> to unset the property.
513    * @return This object (for method chaining).
514    */
515   public HeaderInfo setMinimum(Number value) {
516      minimum = value;
517      return this;
518   }
519
520   /**
521    * Same as {@link #setMinimum(Number)}.
522    * 
523    * @param value
524    *    The new value for this property.
525    *    <br>Non-Number values will be converted to Number using <code>toString()</code> then best number match.
526    *    <br>Can be <jk>null</jk> to unset the property.
527    * @return This object (for method chaining).
528    */
529   public HeaderInfo minimum(Object value) {
530      return setMinimum(toNumber(value));
531   }
532
533   /**
534    * Bean property getter:  <property>exclusiveMinimum</property>.
535    * 
536    * <h5 class='section'>See Also:</h5>
537    * <ul>
538    *    <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>
539    * </ul>
540    * 
541    * @return The property value, or <jk>null</jk> if it is not set.
542    */
543   public Boolean getExclusiveMinimum() {
544      return exclusiveMinimum;
545   }
546
547   /**
548    * Bean property setter:  <property>exclusiveMinimum</property>.
549    * 
550    * <h5 class='section'>See Also:</h5>
551    * <ul>
552    *    <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>
553    * </ul>
554    * 
555    * @param value 
556    *    The new value for this property.
557    *    <br>Can be <jk>null</jk> to unset the property.
558    * @return This object (for method chaining).
559    */
560   public HeaderInfo setExclusiveMinimum(Boolean value) {
561      exclusiveMinimum = value;
562      return this;
563   }
564
565   /**
566    * Same as {@link #setExclusiveMinimum(Boolean)}.
567    * 
568    * @param value
569    *    The new value for this property.
570    *    <br>Non-boolean values will be converted to boolean using <code>Boolean.<jsm>valueOf</jsm>(value.toString())</code>.
571    *    <br>Can be <jk>null</jk> to unset the property.
572    * @return This object (for method chaining).
573    */
574   public HeaderInfo exclusiveMinimum(Object value) {
575      return setExclusiveMinimum(toBoolean(value));
576   }
577
578   /**
579    * Bean property getter:  <property>maxLength</property>.
580    * 
581    * <h5 class='section'>See Also:</h5>
582    * <ul>
583    *    <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>
584    * </ul>
585    * 
586    * @return The property value, or <jk>null</jk> if it is not set.
587    */
588   public Integer getMaxLength() {
589      return maxLength;
590   }
591
592   /**
593    * Bean property setter:  <property>maxLength</property>.
594    * 
595    * <h5 class='section'>See Also:</h5>
596    * <ul>
597    *    <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>
598    * </ul>
599    * 
600    * @param value 
601    *    The new value for this property.
602    *    <br>Can be <jk>null</jk> to unset the property.
603    * @return This object (for method chaining).
604    */
605   public HeaderInfo setMaxLength(Integer value) {
606      maxLength = value;
607      return this;
608   }
609
610   /**
611    * Same as {@link #setMaxLength(Integer)}.
612    * 
613    * @param value
614    *    The new value for this property.
615    *    <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>.
616    *    <br>Can be <jk>null</jk> to unset the property.
617    * @return This object (for method chaining).
618    */
619   public HeaderInfo maxLength(Object value) {
620      return setMaxLength(toInteger(value));
621   }
622
623   /**
624    * Bean property getter:  <property>minLength</property>.
625    * 
626    * <h5 class='section'>See Also:</h5>
627    * <ul>
628    *    <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>
629    * </ul>
630    * 
631    * @return The property value, or <jk>null</jk> if it is not set.
632    */
633   public Integer getMinLength() {
634      return minLength;
635   }
636
637   /**
638    * Bean property setter:  <property>minLength</property>.
639    * 
640    * <h5 class='section'>See Also:</h5>
641    * <ul>
642    *    <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>
643    * </ul>
644    * 
645    * @param value 
646    *    The new value for this property.
647    *    <br>Can be <jk>null</jk> to unset the property.
648    * @return This object (for method chaining).
649    */
650   public HeaderInfo setMinLength(Integer value) {
651      minLength = value;
652      return this;
653   }
654
655   /**
656    * Same as {@link #setMinLength(Integer)}.
657    * 
658    * @param value
659    *    The new value for this property.
660    *    <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>.
661    *    <br>Can be <jk>null</jk> to unset the property.
662    * @return This object (for method chaining).
663    */
664   public HeaderInfo minLength(Object value) {
665      return setMinLength(toInteger(value));
666   }
667
668   /**
669    * Bean property getter:  <property>pattern</property>.
670    * 
671    * <h5 class='section'>See Also:</h5>
672    * <ul>
673    *    <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>
674    * </ul>
675    * 
676    * @return The property value, or <jk>null</jk> if it is not set.
677    */
678   public String getPattern() {
679      return pattern;
680   }
681
682   /**
683    * Bean property setter:  <property>pattern</property>.
684    * 
685    * <h5 class='section'>See Also:</h5>
686    * <ul>
687    *    <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>
688    * </ul>
689    * 
690    * @param value 
691    *    The new value for this property.
692    *    <br>Can be <jk>null</jk> to unset the property.
693    * @return This object (for method chaining).
694    */
695   public HeaderInfo setPattern(String value) {
696      pattern = value;
697      return this;
698   }
699
700   /**
701    * Same as {@link #setPattern(String)}.
702    * 
703    * @param value
704    *    The new value for this property.
705    *    <br>Non-String values will be converted to String using <code>toString()</code>.
706    *    <br>Can be <jk>null</jk> to unset the property.
707    * @return This object (for method chaining).
708    */
709   public HeaderInfo pattern(Object value) {
710      return setPattern(toStringVal(value));
711   }
712
713   /**
714    * Bean property getter:  <property>maxItems</property>.
715    * 
716    * <h5 class='section'>See Also:</h5>
717    * <ul>
718    *    <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>
719    * </ul>
720    * 
721    * @return The property value, or <jk>null</jk> if it is not set.
722    */
723   public Integer getMaxItems() {
724      return maxItems;
725   }
726
727   /**
728    * Bean property setter:  <property>maxItems</property>.
729    * 
730    * <h5 class='section'>See Also:</h5>
731    * <ul>
732    *    <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>
733    * </ul>
734    * 
735    * @param value 
736    *    The new value for this property.
737    *    <br>Can be <jk>null</jk> to unset the property.
738    * @return This object (for method chaining).
739    */
740   public HeaderInfo setMaxItems(Integer value) {
741      maxItems = value;
742      return this;
743   }
744
745   /**
746    * Same as {@link #setMaxItems(Integer)}.
747    * 
748    * @param value
749    *    The new value for this property.
750    *    <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>.
751    *    <br>Can be <jk>null</jk> to unset the property.
752    * @return This object (for method chaining).
753    */
754   public HeaderInfo maxItems(Object value) {
755      return setMaxItems(toInteger(value));
756   }
757
758   /**
759    * Bean property getter:  <property>minItems</property>.
760    * 
761    * <h5 class='section'>See Also:</h5>
762    * <ul>
763    *    <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>
764    * </ul>
765    * 
766    * @return The property value, or <jk>null</jk> if it is not set.
767    */
768   public Integer getMinItems() {
769      return minItems;
770   }
771
772   /**
773    * Bean property setter:  <property>minItems</property>.
774    * 
775    * <h5 class='section'>See Also:</h5>
776    * <ul>
777    *    <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>
778    * </ul>
779    * 
780    * @param value 
781    *    The new value for this property.
782    *    <br>Can be <jk>null</jk> to unset the property.
783    * @return This object (for method chaining).
784    */
785   public HeaderInfo setMinItems(Integer value) {
786      minItems = value;
787      return this;
788   }
789
790   /**
791    * Same as {@link #setMinItems(Integer)}.
792    * 
793    * @param value
794    *    The new value for this property.
795    *    <br>Non-Integer values will be converted to Integer using <code>Integer.<jsm>valueOf</jsm>(value.toString())</code>.
796    *    <br>Can be <jk>null</jk> to unset the property.
797    * @return This object (for method chaining).
798    */
799   public HeaderInfo minItems(Object value) {
800      return setMinItems(toInteger(value));
801   }
802
803   /**
804    * Bean property getter:  <property>uniqueItems</property>.
805    * 
806    * <h5 class='section'>See Also:</h5>
807    * <ul>
808    *    <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>
809    * </ul>
810    * 
811    * @return The property value, or <jk>null</jk> if it is not set.
812    */
813   public Boolean getUniqueItems() {
814      return uniqueItems;
815   }
816
817   /**
818    * Bean property setter:  <property>uniqueItems</property>.
819    * 
820    * <h5 class='section'>See Also:</h5>
821    * <ul>
822    *    <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>
823    * </ul>
824    * 
825    * @param value 
826    *    The new value for this property.
827    *    <br>Can be <jk>null</jk> to unset the property.
828    * @return This object (for method chaining).
829    */
830   public HeaderInfo setUniqueItems(Boolean value) {
831      uniqueItems = value;
832      return this;
833   }
834
835   /**
836    * Same as {@link #setUniqueItems(Boolean)}.
837    * 
838    * @param value
839    *    The new value for this property.
840    *    <br>Non-boolean values will be converted to boolean using <code>Boolean.<jsm>valueOf</jsm>(value.toString())</code>.
841    *    <br>Can be <jk>null</jk> to unset the property.
842    * @return This object (for method chaining).
843    */
844   public HeaderInfo uniqueItems(Object value) {
845      return setUniqueItems(toBoolean(value));
846   }
847
848   /**
849    * Bean property getter:  <property>enum</property>.
850    * 
851    * <h5 class='section'>See Also:</h5>
852    * <ul>
853    *    <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>
854    * </ul>
855    * 
856    * @return The property value, or <jk>null</jk> if it is not set.
857    */
858   public List<Object> getEnum() {
859      return _enum;
860   }
861
862   /**
863    * Bean property setter:  <property>enum</property>.
864    * 
865    * <h5 class='section'>See Also:</h5>
866    * <ul>
867    *    <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>
868    * </ul>
869    * 
870    * @param value 
871    *    The new value for this property.
872    *    <br>Can be <jk>null</jk> to unset the property.
873    * @return This object (for method chaining).
874    */
875   public HeaderInfo setEnum(Collection<Object> value) {
876      _enum = newList(value);
877      return this;
878   }
879
880   /**
881    * Adds one or more values to the <property>enum</property> property.
882    * 
883    * @param values
884    *    The values to add to this property.
885    *    <br>Ignored if <jk>null</jk>.
886    * @return This object (for method chaining).
887    */
888   public HeaderInfo addEnum(Collection<Object> values) {
889      _enum = addToList(_enum, values);
890      return this;
891   }
892   
893   /**
894    * Adds one or more values to the <property>enum</property> property.
895    * 
896    * @param values
897    *    The values to add to this property.
898    *    <br>Valid types:
899    *    <ul>
900    *       <li><code>Object</code>
901    *       <li><code>Collection&lt;Object&gt;</code>
902    *       <li><code>String</code> - JSON array representation of <code>Collection&lt;Object&gt;</code>.
903    *          <h5 class='figure'>Example:</h5>
904    *          <p class='bcode'>
905    *    _enum(<js>"['foo','bar']"</js>);
906    *          </p>
907    *       <li><code>String</code> - Individual values.
908    *          <h5 class='figure'>Example:</h5>
909    *          <p class='bcode'>
910    *    _enum(<js>"foo"</js>, <js>"bar"</js>);
911    *          </p>
912    *    </ul>
913    *    <br>Ignored if <jk>null</jk>.
914    * @return This object (for method chaining).
915    */
916   public HeaderInfo _enum(Object...values) {
917      _enum = addToList(_enum, values, Object.class);
918      return this;
919   }
920   
921   /**
922    * Bean property getter:  <property>multipleOf</property>.
923    * 
924    * <h5 class='section'>See Also:</h5>
925    * <ul>
926    *    <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>
927    * </ul>
928    * 
929    * @return The property value, or <jk>null</jk> if it is not set.
930    */
931   public Number getMultipleOf() {
932      return multipleOf;
933   }
934
935   /**
936    * Bean property setter:  <property>multipleOf</property>.
937    * 
938    * <h5 class='section'>See Also:</h5>
939    * <ul>
940    *    <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>
941    * </ul>
942    * 
943    * @param value 
944    *    The new value for this property.
945    *    <br>Can be <jk>null</jk> to unset the property.
946    * @return This object (for method chaining).
947    */
948   public HeaderInfo setMultipleOf(Number value) {
949      multipleOf = value;
950      return this;
951   }
952
953   /**
954    * Same as {@link #setMultipleOf(Number)}.
955    * 
956    * @param value
957    *    The new value for this property.
958    *    <br>Non-Number values will be converted to Number using <code>toString()</code> then best number match.
959    *    <br>Can be <jk>null</jk> to unset the property.
960    * @return This object (for method chaining).
961    */
962   public HeaderInfo multipleOf(Object value) {
963      return setMultipleOf(toNumber(value));
964   }
965
966   @Override /* SwaggerElement */
967   public <T> T get(String property, Class<T> type) {
968      if (property == null)
969         return null;
970      switch (property) {
971         case "description": return (T)getDescription();
972         case "type": return toType(getType(), type);
973         case "format": return toType(getFormat(), type);
974         case "items": return toType(getItems(), type);
975         case "collectionFormat": return toType(getCollectionFormat(), type);
976         case "default": return toType(getDefault(), type);
977         case "maximum": return toType(getMaximum(), type);
978         case "exclusiveMaximum": return toType(getExclusiveMaximum(), type);
979         case "minimum": return toType(getMinimum(), type);
980         case "exclusiveMinimum": return toType(getExclusiveMinimum(), type);
981         case "maxLength": return toType(getMaxLength(), type);
982         case "minLength": return toType(getMinLength(), type);
983         case "pattern": return toType(getPattern(), type);
984         case "maxItems": return toType(getMaxItems(), type);
985         case "minItems": return toType(getMinItems(), type);
986         case "uniqueItems": return toType(getUniqueItems(), type);
987         case "enum": return toType(getEnum(), type);
988         case "multipleOf": return toType(getMultipleOf(), type);
989         default: return super.get(property, type);
990      }
991   }
992
993   @Override /* SwaggerElement */
994   public HeaderInfo set(String property, Object value) {
995      if (property == null)
996         return this;
997      switch (property) {
998         case "description": return description(value);
999         case "type": return type(value);
1000         case "format": return format(value);
1001         case "items": return items(value);
1002         case "collectionFormat": return collectionFormat(value);
1003         case "default": return _default(value);
1004         case "maximum": return maximum(value);
1005         case "exclusiveMaximum": return exclusiveMaximum(value);
1006         case "minimum": return minimum(value);
1007         case "exclusiveMinimum": return exclusiveMinimum(value);
1008         case "maxLength": return maxLength(value);
1009         case "minLength": return minLength(value);
1010         case "pattern": return pattern(value);
1011         case "maxItems": return maxItems(value);
1012         case "minItems": return minItems(value);
1013         case "uniqueItems": return uniqueItems(value);
1014         case "enum": return setEnum(null)._enum(value);
1015         case "multipleOf": return multipleOf(value);
1016         default: 
1017            super.set(property, value);
1018            return this;
1019      }
1020   }
1021}