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