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