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