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 Header} annotation. 022 */ 023public class HeaderAnnotation implements Header { 024 025 private boolean skipIfEmpty, sie, multi, required, r, allowEmptyValue, aev, exclusiveMaximum, emax, exclusiveMinimum, emin, uniqueItems, ui; 026 private Class<? extends HttpPartSerializer> serializer = HttpPartSerializer.Null.class; 027 private Class<? extends HttpPartParser> parser = HttpPartParser.Null.class; 028 private String name="", n="", value="", type="", t="", format="", f="", collectionFormat="", cf="", maximum="", max="", minimum="", min="", pattern="", p="", multipleOf="", mo=""; 029 private String[] description={}, d={}, _default={}, df={}, _enum={}, e={}, example={}, ex={}, api={}; 030 private Items items = new ItemsAnnotation(); 031 private long maxLength=-1, maxl=-1, minLength=-1, minl=-1, maxItems=-1, maxi=-1, minItems=-1, mini=-1; 032 033 @Override /* Annotation */ 034 public Class<? extends Annotation> annotationType() { 035 return Header.class; 036 } 037 038 @Override /* Header */ 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 HeaderAnnotation skipIfEmpty(boolean value) { 050 this.skipIfEmpty = value; 051 return this; 052 } 053 054 @Override /* Header */ 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 HeaderAnnotation sie(boolean value) { 066 this.sie = value; 067 return this; 068 } 069 070 @Override /* Header */ 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 HeaderAnnotation serializer(Class<? extends HttpPartSerializer> value) { 082 this.serializer = value; 083 return this; 084 } 085 086 @Override /* Header */ 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 HeaderAnnotation parser(Class<? extends HttpPartParser> value) { 098 this.parser = value; 099 return this; 100 } 101 102 @Override /* Header */ 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 HeaderAnnotation multi(boolean value) { 114 this.multi = value; 115 return this; 116 } 117 118 @Override /* Header */ 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 HeaderAnnotation name(String value) { 130 this.name = value; 131 return this; 132 } 133 134 @Override /* Header */ 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 HeaderAnnotation n(String value) { 146 this.n = value; 147 return this; 148 } 149 150 @Override /* Header */ 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 HeaderAnnotation value(String value) { 162 this.value = value; 163 return this; 164 } 165 166 @Override /* Header */ 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 HeaderAnnotation description(String[] value) { 178 this.description = value; 179 return this; 180 } 181 182 @Override /* Header */ 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 HeaderAnnotation d(String[] value) { 194 this.d = value; 195 return this; 196 } 197 198 @Override /* Header */ 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 HeaderAnnotation required(boolean value) { 210 this.required = value; 211 return this; 212 } 213 214 @Override /* Header */ 215 public boolean r() { 216 return r; 217 } 218 219 /** 220 * Sets the <c></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 HeaderAnnotation r(boolean value) { 226 this.r = value; 227 return this; 228 } 229 230 @Override /* Header */ 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 HeaderAnnotation type(String value) { 242 this.type = value; 243 return this; 244 } 245 246 @Override /* Header */ 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 HeaderAnnotation t(String value) { 258 this.t = value; 259 return this; 260 } 261 262 @Override /* Header */ 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 HeaderAnnotation format(String value) { 274 this.format = value; 275 return this; 276 } 277 278 @Override /* Header */ 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 HeaderAnnotation f(String value) { 290 this.f = value; 291 return this; 292 } 293 294 @Override /* Header */ 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 HeaderAnnotation allowEmptyValue(boolean value) { 306 this.allowEmptyValue = value; 307 return this; 308 } 309 310 @Override /* Header */ 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 HeaderAnnotation aev(boolean value) { 322 this.aev = value; 323 return this; 324 } 325 326 @Override /* Header */ 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 HeaderAnnotation items(Items value) { 338 this.items = value; 339 return this; 340 } 341 342 @Override /* Header */ 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 HeaderAnnotation collectionFormat(String value) { 354 this.collectionFormat = value; 355 return this; 356 } 357 358 @Override /* Header */ 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 HeaderAnnotation cf(String value) { 370 this.cf = value; 371 return this; 372 } 373 374 @Override /* Header */ 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 HeaderAnnotation _default(String[] value) { 386 this._default = value; 387 return this; 388 } 389 390 @Override /* Header */ 391 public String[] df() { 392 return df; 393 } 394 395 /** 396 * Sets the <c>df</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 HeaderAnnotation df(String[] value) { 402 this.df = value; 403 return this; 404 } 405 406 @Override /* Header */ 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 HeaderAnnotation maximum(String value) { 418 this.maximum = value; 419 return this; 420 } 421 422 @Override /* Header */ 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 HeaderAnnotation max(String value) { 434 this.max = value; 435 return this; 436 } 437 438 @Override /* Header */ 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 HeaderAnnotation exclusiveMaximum(boolean value) { 450 this.exclusiveMaximum = value; 451 return this; 452 } 453 454 @Override /* Header */ 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 HeaderAnnotation emax(boolean value) { 466 this.emax = value; 467 return this; 468 } 469 470 @Override /* Header */ 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 HeaderAnnotation minimum(String value) { 482 this.minimum = value; 483 return this; 484 } 485 486 @Override /* Header */ 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 HeaderAnnotation min(String value) { 498 this.min = value; 499 return this; 500 } 501 502 @Override /* Header */ 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 HeaderAnnotation exclusiveMinimum(boolean value) { 514 this.exclusiveMinimum = value; 515 return this; 516 } 517 518 @Override /* Header */ 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 HeaderAnnotation emin(boolean value) { 530 this.emin = value; 531 return this; 532 } 533 534 @Override /* Header */ 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 HeaderAnnotation maxLength(long value) { 546 this.maxLength = value; 547 return this; 548 } 549 550 @Override /* Header */ 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 HeaderAnnotation maxl(long value) { 562 this.maxl = value; 563 return this; 564 } 565 566 @Override /* Header */ 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 HeaderAnnotation minLength(long value) { 578 this.minLength = value; 579 return this; 580 } 581 582 @Override /* Header */ 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 HeaderAnnotation minl(long value) { 594 this.minl = value; 595 return this; 596 } 597 598 @Override /* Header */ 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 HeaderAnnotation pattern(String value) { 610 this.pattern = value; 611 return this; 612 } 613 614 @Override /* Header */ 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 HeaderAnnotation p(String value) { 626 this.p = value; 627 return this; 628 } 629 630 @Override /* Header */ 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 HeaderAnnotation maxItems(long value) { 642 this.maxItems = value; 643 return this; 644 } 645 646 @Override /* Header */ 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 HeaderAnnotation maxi(long value) { 658 this.maxi = value; 659 return this; 660 } 661 662 @Override /* Header */ 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 HeaderAnnotation minItems(long value) { 674 this.minItems = value; 675 return this; 676 } 677 678 @Override /* Header */ 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 HeaderAnnotation mini(long value) { 690 this.mini = value; 691 return this; 692 } 693 694 @Override /* Header */ 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 HeaderAnnotation uniqueItems(boolean value) { 706 this.uniqueItems = value; 707 return this; 708 } 709 710 @Override /* Header */ 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 HeaderAnnotation ui(boolean value) { 722 this.ui = value; 723 return this; 724 } 725 726 @Override /* Header */ 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 HeaderAnnotation _enum(String[] value) { 738 this._enum = value; 739 return this; 740 } 741 742 @Override /* Header */ 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 HeaderAnnotation e(String[] value) { 754 this.e = value; 755 return this; 756 } 757 758 @Override /* Header */ 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 HeaderAnnotation multipleOf(String value) { 770 this.multipleOf = value; 771 return this; 772 } 773 774 @Override /* Header */ 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 HeaderAnnotation mo(String value) { 786 this.mo = value; 787 return this; 788 } 789 790 @Override /* Header */ 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 HeaderAnnotation example(String[] value) { 802 this.example = value; 803 return this; 804 } 805 806 @Override /* Header */ 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 HeaderAnnotation ex(String[] value) { 818 this.ex = value; 819 return this; 820 } 821 822 @Override /* Header */ 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 HeaderAnnotation api(String[] value) { 834 this.api = value; 835 return this; 836 } 837}