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.jsonschema.annotation;
014
015import java.lang.annotation.*;
016
017import org.apache.juneau.*;
018
019/**
020 * A concrete implementation of the {@link Items} annotation.
021 *
022 * <ul class='seealso'>
023 *    <li class='jm'>{@link BeanContextBuilder#annotations(Annotation...)}
024 * </ul>
025 */
026public class ItemsAnnotation implements Items {
027
028   private String
029      type = "",
030      t = "",
031      format = "",
032      f = "",
033      collectionFormat = "",
034      cf = "",
035      pattern = "",
036      p = "",
037      maximum = "",
038      max = "",
039      minimum = "",
040      min = "",
041      multipleOf = "",
042      mo = "",
043      $ref = "";
044   private String[]
045      _default = new String[0],
046      df = new String[0],
047      _enum = new String[0],
048      e = new String[0],
049      value = new String[0];
050   private long
051      maxLength = -1,
052      maxl = -1,
053      minLength = -1,
054      minl= -1,
055      maxItems = -1,
056      maxi = -1,
057      minItems = -1,
058      mini = -1;
059   private boolean
060      exclusiveMaximum = false,
061      emax = false,
062      exclusiveMinimum = false,
063      emin = false,
064      uniqueItems = false,
065      ui = false;
066   private SubItems items = new SubItemsAnnotation();
067
068   @Override
069   public Class<? extends Annotation> annotationType() {
070      return Items.class;
071   }
072
073   @Override
074   public String type() {
075      return type;
076   }
077
078   /**
079    * Sets the <c>type</c> property on this annotation.
080    *
081    * @param value The new value for this property.
082    * @return This object (for method chaining).
083    */
084   public ItemsAnnotation type(String value) {
085      this.type = value;
086      return this;
087   }
088
089   @Override
090   public String t() {
091      return t;
092   }
093
094   /**
095    * Sets the <c>t</c> property on this annotation.
096    *
097    * @param value The new value for this property.
098    * @return This object (for method chaining).
099    */
100   public ItemsAnnotation t(String value) {
101      this.t = value;
102      return this;
103   }
104
105   @Override
106   public String format() {
107      return format;
108   }
109
110   /**
111    * Sets the <c>format</c> property on this annotation.
112    *
113    * @param value The new value for this property.
114    * @return This object (for method chaining).
115    */
116   public ItemsAnnotation format(String value) {
117      this.format = value;
118      return this;
119   }
120
121   @Override
122   public String f() {
123      return f;
124   }
125
126   /**
127    * Sets the <c>f</c> property on this annotation.
128    *
129    * @param value The new value for this property.
130    * @return This object (for method chaining).
131    */
132   public ItemsAnnotation f(String value) {
133      this.f = value;
134      return this;
135   }
136
137   @Override
138   public String collectionFormat() {
139      return collectionFormat;
140   }
141
142   /**
143    * Sets the <c>collectionFormat</c> property on this annotation.
144    *
145    * @param value The new value for this property.
146    * @return This object (for method chaining).
147    */
148   public ItemsAnnotation collectionFormat(String value) {
149      this.collectionFormat = value;
150      return this;
151   }
152
153   @Override
154   public String cf() {
155      return cf;
156   }
157
158   /**
159    * Sets the <c>cf</c> property on this annotation.
160    *
161    * @param value The new value for this property.
162    * @return This object (for method chaining).
163    */
164   public ItemsAnnotation cf(String value) {
165      this.cf = value;
166      return this;
167   }
168
169   @Override
170   public String pattern() {
171      return pattern;
172   }
173
174   /**
175    * Sets the <c>pattern</c> property on this annotation.
176    *
177    * @param value The new value for this property.
178    * @return This object (for method chaining).
179    */
180   public ItemsAnnotation pattern(String value) {
181      this.pattern = value;
182      return this;
183   }
184
185   @Override
186   public String p() {
187      return p;
188   }
189
190   /**
191    * Sets the <c>p</c> property on this annotation.
192    *
193    * @param value The new value for this property.
194    * @return This object (for method chaining).
195    */
196   public ItemsAnnotation p(String value) {
197      this.p = value;
198      return this;
199   }
200
201   @Override
202   public String maximum() {
203      return maximum;
204   }
205
206   /**
207    * Sets the <c>maximum</c> property on this annotation.
208    *
209    * @param value The new value for this property.
210    * @return This object (for method chaining).
211    */
212   public ItemsAnnotation maximum(String value) {
213      this.maximum = value;
214      return this;
215   }
216
217   @Override
218   public String max() {
219      return max;
220   }
221
222   /**
223    * Sets the <c>max</c> property on this annotation.
224    *
225    * @param value The new value for this property.
226    * @return This object (for method chaining).
227    */
228   public ItemsAnnotation max(String value) {
229      this.max = value;
230      return this;
231   }
232
233   @Override
234   public String minimum() {
235      return minimum;
236   }
237
238   /**
239    * Sets the <c>minimum</c> property on this annotation.
240    *
241    * @param value The new value for this property.
242    * @return This object (for method chaining).
243    */
244   public ItemsAnnotation minimum(String value) {
245      this.minimum = value;
246      return this;
247   }
248
249   @Override
250   public String min() {
251      return min;
252   }
253
254   /**
255    * Sets the <c>min</c> property on this annotation.
256    *
257    * @param value The new value for this property.
258    * @return This object (for method chaining).
259    */
260   public ItemsAnnotation min(String value) {
261      this.min = value;
262      return this;
263   }
264
265   @Override
266   public String multipleOf() {
267      return multipleOf;
268   }
269
270   /**
271    * Sets the <c>multipleOf</c> property on this annotation.
272    *
273    * @param value The new value for this property.
274    * @return This object (for method chaining).
275    */
276   public ItemsAnnotation multipleOf(String value) {
277      this.multipleOf = value;
278      return this;
279   }
280
281   @Override
282   public String mo() {
283      return mo;
284   }
285
286   /**
287    * Sets the <c>mo</c> property on this annotation.
288    *
289    * @param value The new value for this property.
290    * @return This object (for method chaining).
291    */
292   public ItemsAnnotation mo(String value) {
293      this.mo = value;
294      return this;
295   }
296
297   @Override
298   public long maxLength() {
299      return maxLength;
300   }
301
302   /**
303    * Sets the <c>maxLength</c> property on this annotation.
304    *
305    * @param value The new value for this property.
306    * @return This object (for method chaining).
307    */
308   public ItemsAnnotation maxLength(long value) {
309      this.maxLength = value;
310      return this;
311   }
312
313   @Override
314   public long maxl() {
315      return maxl;
316   }
317
318   /**
319    * Sets the <c>maxl</c> property on this annotation.
320    *
321    * @param value The new value for this property.
322    * @return This object (for method chaining).
323    */
324   public ItemsAnnotation maxl(long value) {
325      this.maxl = value;
326      return this;
327   }
328
329   @Override
330   public long minLength() {
331      return minLength;
332   }
333
334   /**
335    * Sets the <c>minLength</c> property on this annotation.
336    *
337    * @param value The new value for this property.
338    * @return This object (for method chaining).
339    */
340   public ItemsAnnotation minLength(long value) {
341      this.minLength = value;
342      return this;
343   }
344
345   @Override
346   public long minl() {
347      return minl;
348   }
349
350   /**
351    * Sets the <c>minl</c> property on this annotation.
352    *
353    * @param value The new value for this property.
354    * @return This object (for method chaining).
355    */
356   public ItemsAnnotation minl(long value) {
357      this.minl = value;
358      return this;
359   }
360
361   @Override
362   public long maxItems() {
363      return maxItems;
364   }
365
366   /**
367    * Sets the <c>maxItems</c> property on this annotation.
368    *
369    * @param value The new value for this property.
370    * @return This object (for method chaining).
371    */
372   public ItemsAnnotation maxItems(long value) {
373      this.maxItems = value;
374      return this;
375   }
376
377   @Override
378   public long maxi() {
379      return maxi;
380   }
381
382   /**
383    * Sets the <c>maxi</c> property on this annotation.
384    *
385    * @param value The new value for this property.
386    * @return This object (for method chaining).
387    */
388   public ItemsAnnotation maxi(long value) {
389      this.maxi = value;
390      return this;
391   }
392
393   @Override
394   public long minItems() {
395      return minItems;
396   }
397
398   /**
399    * Sets the <c>minItems</c> property on this annotation.
400    *
401    * @param value The new value for this property.
402    * @return This object (for method chaining).
403    */
404   public ItemsAnnotation minItems(long value) {
405      this.minItems = value;
406      return this;
407   }
408
409   @Override
410   public long mini() {
411      return mini;
412   }
413
414   /**
415    * Sets the <c>mini</c> property on this annotation.
416    *
417    * @param value The new value for this property.
418    * @return This object (for method chaining).
419    */
420   public ItemsAnnotation mini(long value) {
421      this.mini = value;
422      return this;
423   }
424
425   @Override
426   public boolean exclusiveMaximum() {
427      return exclusiveMaximum;
428   }
429
430   /**
431    * Sets the <c>exclusiveMaximum</c> property on this annotation.
432    *
433    * @param value The new value for this property.
434    * @return This object (for method chaining).
435    */
436   public ItemsAnnotation exclusiveMaximum(boolean value) {
437      this.exclusiveMaximum = value;
438      return this;
439   }
440
441   @Override
442   public boolean emax() {
443      return emax;
444   }
445
446   /**
447    * Sets the <c>emax</c> property on this annotation.
448    *
449    * @param value The new value for this property.
450    * @return This object (for method chaining).
451    */
452   public ItemsAnnotation emax(boolean value) {
453      this.emax = value;
454      return this;
455   }
456
457   @Override
458   public boolean exclusiveMinimum() {
459      return exclusiveMinimum;
460   }
461
462   /**
463    * Sets the <c>exclusiveMinimum</c> property on this annotation.
464    *
465    * @param value The new value for this property.
466    * @return This object (for method chaining).
467    */
468   public ItemsAnnotation exclusiveMinimum(boolean value) {
469      this.exclusiveMinimum = value;
470      return this;
471   }
472
473   @Override
474   public boolean emin() {
475      return emin;
476   }
477
478   /**
479    * Sets the <c>emin</c> property on this annotation.
480    *
481    * @param value The new value for this property.
482    * @return This object (for method chaining).
483    */
484   public ItemsAnnotation emin(boolean value) {
485      this.emin = value;
486      return this;
487   }
488
489   @Override
490   public boolean uniqueItems() {
491      return uniqueItems;
492   }
493
494   /**
495    * Sets the <c>uniqueItems</c> property on this annotation.
496    *
497    * @param value The new value for this property.
498    * @return This object (for method chaining).
499    */
500   public ItemsAnnotation uniqueItems(boolean value) {
501      this.uniqueItems = value;
502      return this;
503   }
504
505   @Override
506   public boolean ui() {
507      return ui;
508   }
509
510   /**
511    * Sets the <c>ui</c> property on this annotation.
512    *
513    * @param value The new value for this property.
514    * @return This object (for method chaining).
515    */
516   public ItemsAnnotation ui(boolean value) {
517      this.ui = value;
518      return this;
519   }
520
521   @Override
522   public String[] _default() {
523      return _default;
524   }
525
526   /**
527    * Sets the <c>_default</c> property on this annotation.
528    *
529    * @param value The new value for this property.
530    * @return This object (for method chaining).
531    */
532   public ItemsAnnotation _default(String...value) {
533      this._default = value;
534      return this;
535   }
536
537   @Override
538   public String[] df() {
539      return df;
540   }
541
542   /**
543    * Sets the <c>df</c> property on this annotation.
544    *
545    * @param value The new value for this property.
546    * @return This object (for method chaining).
547    */
548   public ItemsAnnotation df(String...value) {
549      this.df = value;
550      return this;
551   }
552
553   @Override
554   public String[] _enum() {
555      return _enum;
556   }
557
558   /**
559    * Sets the <c>_enum</c> property on this annotation.
560    *
561    * @param value The new value for this property.
562    * @return This object (for method chaining).
563    */
564   public ItemsAnnotation _enum(String...value) {
565      this._enum = value;
566      return this;
567   }
568
569   @Override
570   public String[] e() {
571      return e;
572   }
573
574   /**
575    * Sets the <c>e</c> property on this annotation.
576    *
577    * @param value The new value for this property.
578    * @return This object (for method chaining).
579    */
580   public ItemsAnnotation e(String...value) {
581      this.e = value;
582      return this;
583   }
584
585   @Override
586   public String $ref() {
587      return $ref;
588   }
589
590   /**
591    * Sets the <c>$ref</c> property on this annotation.
592    *
593    * @param value The new value for this property.
594    * @return This object (for method chaining).
595    */
596   public ItemsAnnotation $ref(String value) {
597      this.$ref = value;
598      return this;
599   }
600
601   @Override
602   public SubItems items() {
603      return items;
604   }
605
606   /**
607    * Sets the <c>items</c> property on this annotation.
608    *
609    * @param value The new value for this property.
610    * @return This object (for method chaining).
611    */
612   public ItemsAnnotation items(SubItems value) {
613      this.items = value;
614      return this;
615   }
616
617   @Override
618   public String[] value() {
619      return value;
620   }
621
622   /**
623    * Sets the <c>value</c> property on this annotation.
624    *
625    * @param value The new value for this property.
626    * @return This object (for method chaining).
627    */
628   public ItemsAnnotation value(String...value) {
629      this.value = value;
630      return this;
631   }
632}