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.http.annotation;
014
015import java.lang.annotation.*;
016
017import org.apache.juneau.httppart.*;
018import org.apache.juneau.jsonschema.annotation.*;
019
020/**
021 * A concrete implementation of the {@link FormData} annotation.
022 */
023public class FormDataAnnotation implements FormData {
024
025   private boolean skipIfEmpty, sie, aev, allowEmptyValue, emax, emin, exclusiveMaximum, exclusiveMinimum, multi, r, required, ui, uniqueItems;
026   private String[] _default={}, _enum={}, api={}, d={}, description={}, df={}, e={}, ex={}, example={};
027   private String cf="", collectionFormat="", f="", format="", max="", maximum="", min="", minimum="", mo="", multipleOf="", n="", name="", p="", pattern="", t="", type="", value="";
028   private long maxItems=-1, maxi=-1, maxl=-1, maxLength=-1, mini=-1, minItems=-1, minl=-1, minLength=-1;
029   private Items items = new ItemsAnnotation();
030   private Class<? extends HttpPartParser> parser = HttpPartParser.Null.class;
031   private Class<? extends HttpPartSerializer> serializer = HttpPartSerializer.Null.class;
032
033   @Override /* Annotation */
034   public Class<? extends Annotation> annotationType() {
035      return FormData.class;
036   }
037
038   @Override /* FormData */
039   public boolean skipIfEmpty() {
040      return skipIfEmpty;
041   }
042
043   /**
044    * Sets the <c>skipIfEmpty</c> property on this annotation.
045    *
046    * @param value The new value for this property.
047    * @return This object (for method chaining).
048    */
049   public FormDataAnnotation skipIfEmpty(boolean value) {
050      this.skipIfEmpty = value;
051      return this;
052   }
053
054   @Override /* FormData */
055   public boolean sie() {
056      return sie;
057   }
058
059   /**
060    * Sets the <c>sie</c> property on this annotation.
061    *
062    * @param value The new value for this property.
063    * @return This object (for method chaining).
064    */
065   public FormDataAnnotation sie(boolean value) {
066      this.sie = value;
067      return this;
068   }
069
070   @Override /* FormData */
071   public Class<? extends HttpPartSerializer> serializer() {
072      return serializer;
073   }
074
075   /**
076    * Sets the <c>serializer</c> property on this annotation.
077    *
078    * @param value The new value for this property.
079    * @return This object (for method chaining).
080    */
081   public FormDataAnnotation serializer(Class<? extends HttpPartSerializer> value) {
082      this.serializer = value;
083      return this;
084   }
085
086   @Override /* FormData */
087   public Class<? extends HttpPartParser> parser() {
088      return parser;
089   }
090
091   /**
092    * Sets the <c>parser</c> property on this annotation.
093    *
094    * @param value The new value for this property.
095    * @return This object (for method chaining).
096    */
097   public FormDataAnnotation parser(Class<? extends HttpPartParser> value) {
098      this.parser = value;
099      return this;
100   }
101
102   @Override /* FormData */
103   public boolean multi() {
104      return multi;
105   }
106
107   /**
108    * Sets the <c>multi</c> property on this annotation.
109    *
110    * @param value The new value for this property.
111    * @return This object (for method chaining).
112    */
113   public FormDataAnnotation multi(boolean value) {
114      this.multi = value;
115      return this;
116   }
117
118   @Override /* FormData */
119   public String name() {
120      return name;
121   }
122
123   /**
124    * Sets the <c>name</c> property on this annotation.
125    *
126    * @param value The new value for this property.
127    * @return This object (for method chaining).
128    */
129   public FormDataAnnotation name(String value) {
130      this.name = value;
131      return this;
132   }
133
134   @Override /* FormData */
135   public String n() {
136      return n;
137   }
138
139   /**
140    * Sets the <c>n</c> property on this annotation.
141    *
142    * @param value The new value for this property.
143    * @return This object (for method chaining).
144    */
145   public FormDataAnnotation n(String value) {
146      this.n = value;
147      return this;
148   }
149
150   @Override /* FormData */
151   public String value() {
152      return value;
153   }
154
155   /**
156    * Sets the <c>value</c> property on this annotation.
157    *
158    * @param value The new value for this property.
159    * @return This object (for method chaining).
160    */
161   public FormDataAnnotation value(String value) {
162      this.value = value;
163      return this;
164   }
165
166   @Override /* FormData */
167   public String[] description() {
168      return description;
169   }
170
171   /**
172    * Sets the <c>description</c> property on this annotation.
173    *
174    * @param value The new value for this property.
175    * @return This object (for method chaining).
176    */
177   public FormDataAnnotation description(String[] value) {
178      this.description = value;
179      return this;
180   }
181
182   @Override /* FormData */
183   public String[] d() {
184      return d;
185   }
186
187   /**
188    * Sets the <c>d</c> property on this annotation.
189    *
190    * @param value The new value for this property.
191    * @return This object (for method chaining).
192    */
193   public FormDataAnnotation d(String[] value) {
194      this.d = value;
195      return this;
196   }
197
198   @Override /* FormData */
199   public boolean required() {
200      return required;
201   }
202
203   /**
204    * Sets the <c>required</c> property on this annotation.
205    *
206    * @param value The new value for this property.
207    * @return This object (for method chaining).
208    */
209   public FormDataAnnotation required(boolean value) {
210      this.required = value;
211      return this;
212   }
213
214   @Override /* FormData */
215   public boolean r() {
216      return r;
217   }
218
219   /**
220    * Sets the <c>r</c> property on this annotation.
221    *
222    * @param value The new value for this property.
223    * @return This object (for method chaining).
224    */
225   public FormDataAnnotation r(boolean value) {
226      this.r = value;
227      return this;
228   }
229
230   @Override /* FormData */
231   public String type() {
232      return type;
233   }
234
235   /**
236    * Sets the <c>type</c> property on this annotation.
237    *
238    * @param value The new value for this property.
239    * @return This object (for method chaining).
240    */
241   public FormDataAnnotation type(String value) {
242      this.type = value;
243      return this;
244   }
245
246   @Override /* FormData */
247   public String t() {
248      return t;
249   }
250
251   /**
252    * Sets the <c>t</c> property on this annotation.
253    *
254    * @param value The new value for this property.
255    * @return This object (for method chaining).
256    */
257   public FormDataAnnotation t(String value) {
258      this.t = value;
259      return this;
260   }
261
262   @Override /* FormData */
263   public String format() {
264      return format;
265   }
266
267   /**
268    * Sets the <c>format</c> property on this annotation.
269    *
270    * @param value The new value for this property.
271    * @return This object (for method chaining).
272    */
273   public FormDataAnnotation format(String value) {
274      this.format = value;
275      return this;
276   }
277
278   @Override /* FormData */
279   public String f() {
280      return f;
281   }
282
283   /**
284    * Sets the <c>f</c> property on this annotation.
285    *
286    * @param value The new value for this property.
287    * @return This object (for method chaining).
288    */
289   public FormDataAnnotation f(String value) {
290      this.f = value;
291      return this;
292   }
293
294   @Override /* FormData */
295   public boolean allowEmptyValue() {
296      return allowEmptyValue;
297   }
298
299   /**
300    * Sets the <c>allowEmptyValue</c> property on this annotation.
301    *
302    * @param value The new value for this property.
303    * @return This object (for method chaining).
304    */
305   public FormDataAnnotation allowEmptyValue(boolean value) {
306      this.allowEmptyValue = value;
307      return this;
308   }
309
310   @Override /* FormData */
311   public boolean aev() {
312      return aev;
313   }
314
315   /**
316    * Sets the <c>aev</c> property on this annotation.
317    *
318    * @param value The new value for this property.
319    * @return This object (for method chaining).
320    */
321   public FormDataAnnotation aev(boolean value) {
322      this.aev = value;
323      return this;
324   }
325
326   @Override /* FormData */
327   public Items items() {
328      return items;
329   }
330
331   /**
332    * Sets the <c>items</c> property on this annotation.
333    *
334    * @param value The new value for this property.
335    * @return This object (for method chaining).
336    */
337   public FormDataAnnotation items(Items value) {
338      this.items = value;
339      return this;
340   }
341
342   @Override /* FormData */
343   public String collectionFormat() {
344      return collectionFormat;
345   }
346
347   /**
348    * Sets the <c>collectionFormat</c> property on this annotation.
349    *
350    * @param value The new value for this property.
351    * @return This object (for method chaining).
352    */
353   public FormDataAnnotation collectionFormat(String value) {
354      this.collectionFormat = value;
355      return this;
356   }
357
358   @Override /* FormData */
359   public String cf() {
360      return cf;
361   }
362
363   /**
364    * Sets the <c>cf</c> property on this annotation.
365    *
366    * @param value The new value for this property.
367    * @return This object (for method chaining).
368    */
369   public FormDataAnnotation cf(String value) {
370      this.cf = value;
371      return this;
372   }
373
374   @Override /* FormData */
375   public String[] _default() {
376      return _default;
377   }
378
379   /**
380    * Sets the <c>_default</c> property on this annotation.
381    *
382    * @param value The new value for this property.
383    * @return This object (for method chaining).
384    */
385   public FormDataAnnotation _default(String[] value) {
386      this._default = value;
387      return this;
388   }
389
390   @Override /* FormData */
391   public String[] df() {
392      return df;
393   }
394
395   /**
396    * Sets the <c></c> property on this annotation.
397    *
398    * @param value The new value for this property.
399    * @return This object (for method chaining).
400    */
401   public FormDataAnnotation df(String[] value) {
402      this.df = value;
403      return this;
404   }
405
406   @Override /* FormData */
407   public String maximum() {
408      return maximum;
409   }
410
411   /**
412    * Sets the <c>maximum</c> property on this annotation.
413    *
414    * @param value The new value for this property.
415    * @return This object (for method chaining).
416    */
417   public FormDataAnnotation maximum(String value) {
418      this.maximum = value;
419      return this;
420   }
421
422   @Override /* FormData */
423   public String max() {
424      return max;
425   }
426
427   /**
428    * Sets the <c>max</c> property on this annotation.
429    *
430    * @param value The new value for this property.
431    * @return This object (for method chaining).
432    */
433   public FormDataAnnotation max(String value) {
434      this.max = value;
435      return this;
436   }
437
438   @Override /* FormData */
439   public boolean exclusiveMaximum() {
440      return exclusiveMaximum;
441   }
442
443   /**
444    * Sets the <c>exclusiveMaximum</c> property on this annotation.
445    *
446    * @param value The new value for this property.
447    * @return This object (for method chaining).
448    */
449   public FormDataAnnotation exclusiveMaximum(boolean value) {
450      this.exclusiveMaximum = value;
451      return this;
452   }
453
454   @Override /* FormData */
455   public boolean emax() {
456      return emax;
457   }
458
459   /**
460    * Sets the <c>emax</c> property on this annotation.
461    *
462    * @param value The new value for this property.
463    * @return This object (for method chaining).
464    */
465   public FormDataAnnotation emax(boolean value) {
466      this.emax = value;
467      return this;
468   }
469
470   @Override /* FormData */
471   public String minimum() {
472      return minimum;
473   }
474
475   /**
476    * Sets the <c>minimum</c> property on this annotation.
477    *
478    * @param value The new value for this property.
479    * @return This object (for method chaining).
480    */
481   public FormDataAnnotation minimum(String value) {
482      this.minimum = value;
483      return this;
484   }
485
486   @Override /* FormData */
487   public String min() {
488      return min;
489   }
490
491   /**
492    * Sets the <c>min</c> property on this annotation.
493    *
494    * @param value The new value for this property.
495    * @return This object (for method chaining).
496    */
497   public FormDataAnnotation min(String value) {
498      this.min = value;
499      return this;
500   }
501
502   @Override /* FormData */
503   public boolean exclusiveMinimum() {
504      return exclusiveMinimum;
505   }
506
507   /**
508    * Sets the <c>exclusiveMinimum</c> property on this annotation.
509    *
510    * @param value The new value for this property.
511    * @return This object (for method chaining).
512    */
513   public FormDataAnnotation exclusiveMinimum(boolean value) {
514      this.exclusiveMinimum = value;
515      return this;
516   }
517
518   @Override /* FormData */
519   public boolean emin() {
520      return emin;
521   }
522
523   /**
524    * Sets the <c>emin</c> property on this annotation.
525    *
526    * @param value The new value for this property.
527    * @return This object (for method chaining).
528    */
529   public FormDataAnnotation emin(boolean value) {
530      this.emin = value;
531      return this;
532   }
533
534   @Override /* FormData */
535   public long maxLength() {
536      return maxLength;
537   }
538
539   /**
540    * Sets the <c>maxLength</c> property on this annotation.
541    *
542    * @param value The new value for this property.
543    * @return This object (for method chaining).
544    */
545   public FormDataAnnotation maxLength(long value) {
546      this.maxLength = value;
547      return this;
548   }
549
550   @Override /* FormData */
551   public long maxl() {
552      return maxl;
553   }
554
555   /**
556    * Sets the <c>maxl</c> property on this annotation.
557    *
558    * @param value The new value for this property.
559    * @return This object (for method chaining).
560    */
561   public FormDataAnnotation maxl(long value) {
562      this.maxl = value;
563      return this;
564   }
565
566   @Override /* FormData */
567   public long minLength() {
568      return minLength;
569   }
570
571   /**
572    * Sets the <c>minLength</c> property on this annotation.
573    *
574    * @param value The new value for this property.
575    * @return This object (for method chaining).
576    */
577   public FormDataAnnotation minLength(long value) {
578      this.minLength = value;
579      return this;
580   }
581
582   @Override /* FormData */
583   public long minl() {
584      return minl;
585   }
586
587   /**
588    * Sets the <c>minl</c> property on this annotation.
589    *
590    * @param value The new value for this property.
591    * @return This object (for method chaining).
592    */
593   public FormDataAnnotation minl(long value) {
594      this.minl = value;
595      return this;
596   }
597
598   @Override /* FormData */
599   public String pattern() {
600      return pattern;
601   }
602
603   /**
604    * Sets the <c>pattern</c> property on this annotation.
605    *
606    * @param value The new value for this property.
607    * @return This object (for method chaining).
608    */
609   public FormDataAnnotation pattern(String value) {
610      this.pattern = value;
611      return this;
612   }
613
614   @Override /* FormData */
615   public String p() {
616      return p;
617   }
618
619   /**
620    * Sets the <c>p</c> property on this annotation.
621    *
622    * @param value The new value for this property.
623    * @return This object (for method chaining).
624    */
625   public FormDataAnnotation p(String value) {
626      this.p = value;
627      return this;
628   }
629
630   @Override /* FormData */
631   public long maxItems() {
632      return maxItems;
633   }
634
635   /**
636    * Sets the <c>maxItems</c> property on this annotation.
637    *
638    * @param value The new value for this property.
639    * @return This object (for method chaining).
640    */
641   public FormDataAnnotation maxItems(long value) {
642      this.maxItems = value;
643      return this;
644   }
645
646   @Override /* FormData */
647   public long maxi() {
648      return maxi;
649   }
650
651   /**
652    * Sets the <c>maxi</c> property on this annotation.
653    *
654    * @param value The new value for this property.
655    * @return This object (for method chaining).
656    */
657   public FormDataAnnotation maxi(long value) {
658      this.maxi = value;
659      return this;
660   }
661
662   @Override /* FormData */
663   public long minItems() {
664      return minItems;
665   }
666
667   /**
668    * Sets the <c>minItems</c> property on this annotation.
669    *
670    * @param value The new value for this property.
671    * @return This object (for method chaining).
672    */
673   public FormDataAnnotation minItems(long value) {
674      this.minItems = value;
675      return this;
676   }
677
678   @Override /* FormData */
679   public long mini() {
680      return mini;
681   }
682
683   /**
684    * Sets the <c>mini</c> property on this annotation.
685    *
686    * @param value The new value for this property.
687    * @return This object (for method chaining).
688    */
689   public FormDataAnnotation mini(long value) {
690      this.mini = value;
691      return this;
692   }
693
694   @Override /* FormData */
695   public boolean uniqueItems() {
696      return uniqueItems;
697   }
698
699   /**
700    * Sets the <c>uniqueItems</c> property on this annotation.
701    *
702    * @param value The new value for this property.
703    * @return This object (for method chaining).
704    */
705   public FormDataAnnotation uniqueItems(boolean value) {
706      this.uniqueItems = value;
707      return this;
708   }
709
710   @Override /* FormData */
711   public boolean ui() {
712      return ui;
713   }
714
715   /**
716    * Sets the <c>ui</c> property on this annotation.
717    *
718    * @param value The new value for this property.
719    * @return This object (for method chaining).
720    */
721   public FormDataAnnotation ui(boolean value) {
722      this.ui = value;
723      return this;
724   }
725
726   @Override /* FormData */
727   public String[] _enum() {
728      return _enum;
729   }
730
731   /**
732    * Sets the <c>_enum</c> property on this annotation.
733    *
734    * @param value The new value for this property.
735    * @return This object (for method chaining).
736    */
737   public FormDataAnnotation _enum(String[] value) {
738      this._enum = value;
739      return this;
740   }
741
742   @Override /* FormData */
743   public String[] e() {
744      return e;
745   }
746
747   /**
748    * Sets the <c>e</c> property on this annotation.
749    *
750    * @param value The new value for this property.
751    * @return This object (for method chaining).
752    */
753   public FormDataAnnotation e(String[] value) {
754      this.e = value;
755      return this;
756   }
757
758   @Override /* FormData */
759   public String multipleOf() {
760      return multipleOf;
761   }
762
763   /**
764    * Sets the <c>multipleOf</c> property on this annotation.
765    *
766    * @param value The new value for this property.
767    * @return This object (for method chaining).
768    */
769   public FormDataAnnotation multipleOf(String value) {
770      this.multipleOf = value;
771      return this;
772   }
773
774   @Override /* FormData */
775   public String mo() {
776      return mo;
777   }
778
779   /**
780    * Sets the <c>mo</c> property on this annotation.
781    *
782    * @param value The new value for this property.
783    * @return This object (for method chaining).
784    */
785   public FormDataAnnotation mo(String value) {
786      this.mo = value;
787      return this;
788   }
789
790   @Override /* FormData */
791   public String[] example() {
792      return example;
793   }
794
795   /**
796    * Sets the <c>example</c> property on this annotation.
797    *
798    * @param value The new value for this property.
799    * @return This object (for method chaining).
800    */
801   public FormDataAnnotation example(String[] value) {
802      this.example = value;
803      return this;
804   }
805
806   @Override /* FormData */
807   public String[] ex() {
808      return ex;
809   }
810
811   /**
812    * Sets the <c>ex</c> property on this annotation.
813    *
814    * @param value The new value for this property.
815    * @return This object (for method chaining).
816    */
817   public FormDataAnnotation ex(String[] value) {
818      this.ex = value;
819      return this;
820   }
821
822   @Override /* FormData */
823   public String[] api() {
824      return api;
825   }
826
827   /**
828    * Sets the <c>api</c> property on this annotation.
829    *
830    * @param value The new value for this property.
831    * @return This object (for method chaining).
832    */
833   public FormDataAnnotation api(String[] value) {
834      this.api = value;
835      return this;
836   }
837}