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