001 002package com.commercetools.importapi.models.common; 003 004import java.util.*; 005import java.util.function.Function; 006 007import javax.annotation.Nullable; 008 009import io.vrap.rmf.base.client.Builder; 010import io.vrap.rmf.base.client.utils.Generated; 011 012/** 013 * AddressBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * Address address = Address.builder() 019 * .country("{country}") 020 * .build() 021 * </code></pre> 022 * </div> 023 */ 024@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 025public class AddressBuilder implements Builder<Address> { 026 027 @Nullable 028 private String id; 029 030 @Nullable 031 private String key; 032 033 @Nullable 034 private String title; 035 036 @Nullable 037 private String salutation; 038 039 @Nullable 040 private String firstName; 041 042 @Nullable 043 private String lastName; 044 045 @Nullable 046 private String streetName; 047 048 @Nullable 049 private String streetNumber; 050 051 @Nullable 052 private String additionalStreetInfo; 053 054 @Nullable 055 private String postalCode; 056 057 @Nullable 058 private String city; 059 060 @Nullable 061 private String region; 062 063 @Nullable 064 private String state; 065 066 private String country; 067 068 @Nullable 069 private String company; 070 071 @Nullable 072 private String department; 073 074 @Nullable 075 private String building; 076 077 @Nullable 078 private String apartment; 079 080 @Nullable 081 private String pOBox; 082 083 @Nullable 084 private String phone; 085 086 @Nullable 087 private String mobile; 088 089 @Nullable 090 private String email; 091 092 @Nullable 093 private String fax; 094 095 @Nullable 096 private String additionalAddressInfo; 097 098 @Nullable 099 private String externalId; 100 101 @Nullable 102 private com.commercetools.importapi.models.customfields.Custom custom; 103 104 /** 105 * set the value to the id 106 * @param id value to be set 107 * @return Builder 108 */ 109 110 public AddressBuilder id(@Nullable final String id) { 111 this.id = id; 112 return this; 113 } 114 115 /** 116 * set the value to the key 117 * @param key value to be set 118 * @return Builder 119 */ 120 121 public AddressBuilder key(@Nullable final String key) { 122 this.key = key; 123 return this; 124 } 125 126 /** 127 * set the value to the title 128 * @param title value to be set 129 * @return Builder 130 */ 131 132 public AddressBuilder title(@Nullable final String title) { 133 this.title = title; 134 return this; 135 } 136 137 /** 138 * set the value to the salutation 139 * @param salutation value to be set 140 * @return Builder 141 */ 142 143 public AddressBuilder salutation(@Nullable final String salutation) { 144 this.salutation = salutation; 145 return this; 146 } 147 148 /** 149 * set the value to the firstName 150 * @param firstName value to be set 151 * @return Builder 152 */ 153 154 public AddressBuilder firstName(@Nullable final String firstName) { 155 this.firstName = firstName; 156 return this; 157 } 158 159 /** 160 * set the value to the lastName 161 * @param lastName value to be set 162 * @return Builder 163 */ 164 165 public AddressBuilder lastName(@Nullable final String lastName) { 166 this.lastName = lastName; 167 return this; 168 } 169 170 /** 171 * set the value to the streetName 172 * @param streetName value to be set 173 * @return Builder 174 */ 175 176 public AddressBuilder streetName(@Nullable final String streetName) { 177 this.streetName = streetName; 178 return this; 179 } 180 181 /** 182 * set the value to the streetNumber 183 * @param streetNumber value to be set 184 * @return Builder 185 */ 186 187 public AddressBuilder streetNumber(@Nullable final String streetNumber) { 188 this.streetNumber = streetNumber; 189 return this; 190 } 191 192 /** 193 * set the value to the additionalStreetInfo 194 * @param additionalStreetInfo value to be set 195 * @return Builder 196 */ 197 198 public AddressBuilder additionalStreetInfo(@Nullable final String additionalStreetInfo) { 199 this.additionalStreetInfo = additionalStreetInfo; 200 return this; 201 } 202 203 /** 204 * set the value to the postalCode 205 * @param postalCode value to be set 206 * @return Builder 207 */ 208 209 public AddressBuilder postalCode(@Nullable final String postalCode) { 210 this.postalCode = postalCode; 211 return this; 212 } 213 214 /** 215 * set the value to the city 216 * @param city value to be set 217 * @return Builder 218 */ 219 220 public AddressBuilder city(@Nullable final String city) { 221 this.city = city; 222 return this; 223 } 224 225 /** 226 * set the value to the region 227 * @param region value to be set 228 * @return Builder 229 */ 230 231 public AddressBuilder region(@Nullable final String region) { 232 this.region = region; 233 return this; 234 } 235 236 /** 237 * set the value to the state 238 * @param state value to be set 239 * @return Builder 240 */ 241 242 public AddressBuilder state(@Nullable final String state) { 243 this.state = state; 244 return this; 245 } 246 247 /** 248 * <p>A two-digit country code as per ISO 3166-1 alpha-2.</p> 249 * @param country value to be set 250 * @return Builder 251 */ 252 253 public AddressBuilder country(final String country) { 254 this.country = country; 255 return this; 256 } 257 258 /** 259 * set the value to the company 260 * @param company value to be set 261 * @return Builder 262 */ 263 264 public AddressBuilder company(@Nullable final String company) { 265 this.company = company; 266 return this; 267 } 268 269 /** 270 * set the value to the department 271 * @param department value to be set 272 * @return Builder 273 */ 274 275 public AddressBuilder department(@Nullable final String department) { 276 this.department = department; 277 return this; 278 } 279 280 /** 281 * set the value to the building 282 * @param building value to be set 283 * @return Builder 284 */ 285 286 public AddressBuilder building(@Nullable final String building) { 287 this.building = building; 288 return this; 289 } 290 291 /** 292 * set the value to the apartment 293 * @param apartment value to be set 294 * @return Builder 295 */ 296 297 public AddressBuilder apartment(@Nullable final String apartment) { 298 this.apartment = apartment; 299 return this; 300 } 301 302 /** 303 * set the value to the pOBox 304 * @param pOBox value to be set 305 * @return Builder 306 */ 307 308 public AddressBuilder pOBox(@Nullable final String pOBox) { 309 this.pOBox = pOBox; 310 return this; 311 } 312 313 /** 314 * set the value to the phone 315 * @param phone value to be set 316 * @return Builder 317 */ 318 319 public AddressBuilder phone(@Nullable final String phone) { 320 this.phone = phone; 321 return this; 322 } 323 324 /** 325 * set the value to the mobile 326 * @param mobile value to be set 327 * @return Builder 328 */ 329 330 public AddressBuilder mobile(@Nullable final String mobile) { 331 this.mobile = mobile; 332 return this; 333 } 334 335 /** 336 * set the value to the email 337 * @param email value to be set 338 * @return Builder 339 */ 340 341 public AddressBuilder email(@Nullable final String email) { 342 this.email = email; 343 return this; 344 } 345 346 /** 347 * set the value to the fax 348 * @param fax value to be set 349 * @return Builder 350 */ 351 352 public AddressBuilder fax(@Nullable final String fax) { 353 this.fax = fax; 354 return this; 355 } 356 357 /** 358 * set the value to the additionalAddressInfo 359 * @param additionalAddressInfo value to be set 360 * @return Builder 361 */ 362 363 public AddressBuilder additionalAddressInfo(@Nullable final String additionalAddressInfo) { 364 this.additionalAddressInfo = additionalAddressInfo; 365 return this; 366 } 367 368 /** 369 * set the value to the externalId 370 * @param externalId value to be set 371 * @return Builder 372 */ 373 374 public AddressBuilder externalId(@Nullable final String externalId) { 375 this.externalId = externalId; 376 return this; 377 } 378 379 /** 380 * <p>Custom Fields defined for the Address. Custom Fields can only be applied to <code>shippingAddress</code>.</p> 381 * @param builder function to build the custom value 382 * @return Builder 383 */ 384 385 public AddressBuilder custom( 386 Function<com.commercetools.importapi.models.customfields.CustomBuilder, com.commercetools.importapi.models.customfields.CustomBuilder> builder) { 387 this.custom = builder.apply(com.commercetools.importapi.models.customfields.CustomBuilder.of()).build(); 388 return this; 389 } 390 391 /** 392 * <p>Custom Fields defined for the Address. Custom Fields can only be applied to <code>shippingAddress</code>.</p> 393 * @param builder function to build the custom value 394 * @return Builder 395 */ 396 397 public AddressBuilder withCustom( 398 Function<com.commercetools.importapi.models.customfields.CustomBuilder, com.commercetools.importapi.models.customfields.Custom> builder) { 399 this.custom = builder.apply(com.commercetools.importapi.models.customfields.CustomBuilder.of()); 400 return this; 401 } 402 403 /** 404 * <p>Custom Fields defined for the Address. Custom Fields can only be applied to <code>shippingAddress</code>.</p> 405 * @param custom value to be set 406 * @return Builder 407 */ 408 409 public AddressBuilder custom(@Nullable final com.commercetools.importapi.models.customfields.Custom custom) { 410 this.custom = custom; 411 return this; 412 } 413 414 /** 415 * value of id} 416 * @return id 417 */ 418 419 @Nullable 420 public String getId() { 421 return this.id; 422 } 423 424 /** 425 * value of key} 426 * @return key 427 */ 428 429 @Nullable 430 public String getKey() { 431 return this.key; 432 } 433 434 /** 435 * value of title} 436 * @return title 437 */ 438 439 @Nullable 440 public String getTitle() { 441 return this.title; 442 } 443 444 /** 445 * value of salutation} 446 * @return salutation 447 */ 448 449 @Nullable 450 public String getSalutation() { 451 return this.salutation; 452 } 453 454 /** 455 * value of firstName} 456 * @return firstName 457 */ 458 459 @Nullable 460 public String getFirstName() { 461 return this.firstName; 462 } 463 464 /** 465 * value of lastName} 466 * @return lastName 467 */ 468 469 @Nullable 470 public String getLastName() { 471 return this.lastName; 472 } 473 474 /** 475 * value of streetName} 476 * @return streetName 477 */ 478 479 @Nullable 480 public String getStreetName() { 481 return this.streetName; 482 } 483 484 /** 485 * value of streetNumber} 486 * @return streetNumber 487 */ 488 489 @Nullable 490 public String getStreetNumber() { 491 return this.streetNumber; 492 } 493 494 /** 495 * value of additionalStreetInfo} 496 * @return additionalStreetInfo 497 */ 498 499 @Nullable 500 public String getAdditionalStreetInfo() { 501 return this.additionalStreetInfo; 502 } 503 504 /** 505 * value of postalCode} 506 * @return postalCode 507 */ 508 509 @Nullable 510 public String getPostalCode() { 511 return this.postalCode; 512 } 513 514 /** 515 * value of city} 516 * @return city 517 */ 518 519 @Nullable 520 public String getCity() { 521 return this.city; 522 } 523 524 /** 525 * value of region} 526 * @return region 527 */ 528 529 @Nullable 530 public String getRegion() { 531 return this.region; 532 } 533 534 /** 535 * value of state} 536 * @return state 537 */ 538 539 @Nullable 540 public String getState() { 541 return this.state; 542 } 543 544 /** 545 * <p>A two-digit country code as per ISO 3166-1 alpha-2.</p> 546 * @return country 547 */ 548 549 public String getCountry() { 550 return this.country; 551 } 552 553 /** 554 * value of company} 555 * @return company 556 */ 557 558 @Nullable 559 public String getCompany() { 560 return this.company; 561 } 562 563 /** 564 * value of department} 565 * @return department 566 */ 567 568 @Nullable 569 public String getDepartment() { 570 return this.department; 571 } 572 573 /** 574 * value of building} 575 * @return building 576 */ 577 578 @Nullable 579 public String getBuilding() { 580 return this.building; 581 } 582 583 /** 584 * value of apartment} 585 * @return apartment 586 */ 587 588 @Nullable 589 public String getApartment() { 590 return this.apartment; 591 } 592 593 /** 594 * value of pOBox} 595 * @return pOBox 596 */ 597 598 @Nullable 599 public String getPOBox() { 600 return this.pOBox; 601 } 602 603 /** 604 * value of phone} 605 * @return phone 606 */ 607 608 @Nullable 609 public String getPhone() { 610 return this.phone; 611 } 612 613 /** 614 * value of mobile} 615 * @return mobile 616 */ 617 618 @Nullable 619 public String getMobile() { 620 return this.mobile; 621 } 622 623 /** 624 * value of email} 625 * @return email 626 */ 627 628 @Nullable 629 public String getEmail() { 630 return this.email; 631 } 632 633 /** 634 * value of fax} 635 * @return fax 636 */ 637 638 @Nullable 639 public String getFax() { 640 return this.fax; 641 } 642 643 /** 644 * value of additionalAddressInfo} 645 * @return additionalAddressInfo 646 */ 647 648 @Nullable 649 public String getAdditionalAddressInfo() { 650 return this.additionalAddressInfo; 651 } 652 653 /** 654 * value of externalId} 655 * @return externalId 656 */ 657 658 @Nullable 659 public String getExternalId() { 660 return this.externalId; 661 } 662 663 /** 664 * <p>Custom Fields defined for the Address. Custom Fields can only be applied to <code>shippingAddress</code>.</p> 665 * @return custom 666 */ 667 668 @Nullable 669 public com.commercetools.importapi.models.customfields.Custom getCustom() { 670 return this.custom; 671 } 672 673 /** 674 * builds Address with checking for non-null required values 675 * @return Address 676 */ 677 public Address build() { 678 Objects.requireNonNull(country, Address.class + ": country is missing"); 679 return new AddressImpl(id, key, title, salutation, firstName, lastName, streetName, streetNumber, 680 additionalStreetInfo, postalCode, city, region, state, country, company, department, building, apartment, 681 pOBox, phone, mobile, email, fax, additionalAddressInfo, externalId, custom); 682 } 683 684 /** 685 * builds Address without checking for non-null required values 686 * @return Address 687 */ 688 public Address buildUnchecked() { 689 return new AddressImpl(id, key, title, salutation, firstName, lastName, streetName, streetNumber, 690 additionalStreetInfo, postalCode, city, region, state, country, company, department, building, apartment, 691 pOBox, phone, mobile, email, fax, additionalAddressInfo, externalId, custom); 692 } 693 694 /** 695 * factory method for an instance of AddressBuilder 696 * @return builder 697 */ 698 public static AddressBuilder of() { 699 return new AddressBuilder(); 700 } 701 702 /** 703 * create builder for Address instance 704 * @param template instance with prefilled values for the builder 705 * @return builder 706 */ 707 public static AddressBuilder of(final Address template) { 708 AddressBuilder builder = new AddressBuilder(); 709 builder.id = template.getId(); 710 builder.key = template.getKey(); 711 builder.title = template.getTitle(); 712 builder.salutation = template.getSalutation(); 713 builder.firstName = template.getFirstName(); 714 builder.lastName = template.getLastName(); 715 builder.streetName = template.getStreetName(); 716 builder.streetNumber = template.getStreetNumber(); 717 builder.additionalStreetInfo = template.getAdditionalStreetInfo(); 718 builder.postalCode = template.getPostalCode(); 719 builder.city = template.getCity(); 720 builder.region = template.getRegion(); 721 builder.state = template.getState(); 722 builder.country = template.getCountry(); 723 builder.company = template.getCompany(); 724 builder.department = template.getDepartment(); 725 builder.building = template.getBuilding(); 726 builder.apartment = template.getApartment(); 727 builder.pOBox = template.getPOBox(); 728 builder.phone = template.getPhone(); 729 builder.mobile = template.getMobile(); 730 builder.email = template.getEmail(); 731 builder.fax = template.getFax(); 732 builder.additionalAddressInfo = template.getAdditionalAddressInfo(); 733 builder.externalId = template.getExternalId(); 734 builder.custom = template.getCustom(); 735 return builder; 736 } 737 738}