001 002package com.commercetools.api.models.message; 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 * StoreCreatedMessagePayloadBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * StoreCreatedMessagePayload storeCreatedMessagePayload = StoreCreatedMessagePayload.builder() 019 * .plusDistributionChannels(distributionChannelsBuilder -> distributionChannelsBuilder) 020 * .plusSupplyChannels(supplyChannelsBuilder -> supplyChannelsBuilder) 021 * .plusProductSelections(productSelectionsBuilder -> productSelectionsBuilder) 022 * .build() 023 * </code></pre> 024 * </div> 025 */ 026@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 027public class StoreCreatedMessagePayloadBuilder implements Builder<StoreCreatedMessagePayload> { 028 029 @Nullable 030 private com.commercetools.api.models.common.LocalizedString name; 031 032 @Nullable 033 private java.util.List<String> languages; 034 035 @Nullable 036 private java.util.List<com.commercetools.api.models.store_country.StoreCountry> countries; 037 038 private java.util.List<com.commercetools.api.models.channel.ChannelReference> distributionChannels; 039 040 private java.util.List<com.commercetools.api.models.channel.ChannelReference> supplyChannels; 041 042 private java.util.List<com.commercetools.api.models.store.ProductSelectionSetting> productSelections; 043 044 @Nullable 045 private com.commercetools.api.models.type.CustomFields custom; 046 047 /** 048 * <p>The <code>name</code> of the Store that was created.</p> 049 * @param builder function to build the name value 050 * @return Builder 051 */ 052 053 public StoreCreatedMessagePayloadBuilder name( 054 Function<com.commercetools.api.models.common.LocalizedStringBuilder, com.commercetools.api.models.common.LocalizedStringBuilder> builder) { 055 this.name = builder.apply(com.commercetools.api.models.common.LocalizedStringBuilder.of()).build(); 056 return this; 057 } 058 059 /** 060 * <p>The <code>name</code> of the Store that was created.</p> 061 * @param builder function to build the name value 062 * @return Builder 063 */ 064 065 public StoreCreatedMessagePayloadBuilder withName( 066 Function<com.commercetools.api.models.common.LocalizedStringBuilder, com.commercetools.api.models.common.LocalizedString> builder) { 067 this.name = builder.apply(com.commercetools.api.models.common.LocalizedStringBuilder.of()); 068 return this; 069 } 070 071 /** 072 * <p>The <code>name</code> of the Store that was created.</p> 073 * @param name value to be set 074 * @return Builder 075 */ 076 077 public StoreCreatedMessagePayloadBuilder name( 078 @Nullable final com.commercetools.api.models.common.LocalizedString name) { 079 this.name = name; 080 return this; 081 } 082 083 /** 084 * <p>Languages of the Store that was created. Languages are represented as IETF language tags.</p> 085 * @param languages value to be set 086 * @return Builder 087 */ 088 089 public StoreCreatedMessagePayloadBuilder languages(@Nullable final String... languages) { 090 this.languages = new ArrayList<>(Arrays.asList(languages)); 091 return this; 092 } 093 094 /** 095 * <p>Languages of the Store that was created. Languages are represented as IETF language tags.</p> 096 * @param languages value to be set 097 * @return Builder 098 */ 099 100 public StoreCreatedMessagePayloadBuilder languages(@Nullable final java.util.List<String> languages) { 101 this.languages = languages; 102 return this; 103 } 104 105 /** 106 * <p>Languages of the Store that was created. Languages are represented as IETF language tags.</p> 107 * @param languages value to be set 108 * @return Builder 109 */ 110 111 public StoreCreatedMessagePayloadBuilder plusLanguages(@Nullable final String... languages) { 112 if (this.languages == null) { 113 this.languages = new ArrayList<>(); 114 } 115 this.languages.addAll(Arrays.asList(languages)); 116 return this; 117 } 118 119 /** 120 * <p>Countries of the Store that was created.</p> 121 * @param countries value to be set 122 * @return Builder 123 */ 124 125 public StoreCreatedMessagePayloadBuilder countries( 126 @Nullable final com.commercetools.api.models.store_country.StoreCountry... countries) { 127 this.countries = new ArrayList<>(Arrays.asList(countries)); 128 return this; 129 } 130 131 /** 132 * <p>Countries of the Store that was created.</p> 133 * @param countries value to be set 134 * @return Builder 135 */ 136 137 public StoreCreatedMessagePayloadBuilder countries( 138 @Nullable final java.util.List<com.commercetools.api.models.store_country.StoreCountry> countries) { 139 this.countries = countries; 140 return this; 141 } 142 143 /** 144 * <p>Countries of the Store that was created.</p> 145 * @param countries value to be set 146 * @return Builder 147 */ 148 149 public StoreCreatedMessagePayloadBuilder plusCountries( 150 @Nullable final com.commercetools.api.models.store_country.StoreCountry... countries) { 151 if (this.countries == null) { 152 this.countries = new ArrayList<>(); 153 } 154 this.countries.addAll(Arrays.asList(countries)); 155 return this; 156 } 157 158 /** 159 * <p>Countries of the Store that was created.</p> 160 * @param builder function to build the countries value 161 * @return Builder 162 */ 163 164 public StoreCreatedMessagePayloadBuilder plusCountries( 165 Function<com.commercetools.api.models.store_country.StoreCountryBuilder, com.commercetools.api.models.store_country.StoreCountryBuilder> builder) { 166 if (this.countries == null) { 167 this.countries = new ArrayList<>(); 168 } 169 this.countries.add(builder.apply(com.commercetools.api.models.store_country.StoreCountryBuilder.of()).build()); 170 return this; 171 } 172 173 /** 174 * <p>Countries of the Store that was created.</p> 175 * @param builder function to build the countries value 176 * @return Builder 177 */ 178 179 public StoreCreatedMessagePayloadBuilder withCountries( 180 Function<com.commercetools.api.models.store_country.StoreCountryBuilder, com.commercetools.api.models.store_country.StoreCountryBuilder> builder) { 181 this.countries = new ArrayList<>(); 182 this.countries.add(builder.apply(com.commercetools.api.models.store_country.StoreCountryBuilder.of()).build()); 183 return this; 184 } 185 186 /** 187 * <p>Countries of the Store that was created.</p> 188 * @param builder function to build the countries value 189 * @return Builder 190 */ 191 192 public StoreCreatedMessagePayloadBuilder addCountries( 193 Function<com.commercetools.api.models.store_country.StoreCountryBuilder, com.commercetools.api.models.store_country.StoreCountry> builder) { 194 return plusCountries(builder.apply(com.commercetools.api.models.store_country.StoreCountryBuilder.of())); 195 } 196 197 /** 198 * <p>Countries of the Store that was created.</p> 199 * @param builder function to build the countries value 200 * @return Builder 201 */ 202 203 public StoreCreatedMessagePayloadBuilder setCountries( 204 Function<com.commercetools.api.models.store_country.StoreCountryBuilder, com.commercetools.api.models.store_country.StoreCountry> builder) { 205 return countries(builder.apply(com.commercetools.api.models.store_country.StoreCountryBuilder.of())); 206 } 207 208 /** 209 * <p>Distribution Channels of the Store that was created.</p> 210 * @param distributionChannels value to be set 211 * @return Builder 212 */ 213 214 public StoreCreatedMessagePayloadBuilder distributionChannels( 215 final com.commercetools.api.models.channel.ChannelReference... distributionChannels) { 216 this.distributionChannels = new ArrayList<>(Arrays.asList(distributionChannels)); 217 return this; 218 } 219 220 /** 221 * <p>Distribution Channels of the Store that was created.</p> 222 * @param distributionChannels value to be set 223 * @return Builder 224 */ 225 226 public StoreCreatedMessagePayloadBuilder distributionChannels( 227 final java.util.List<com.commercetools.api.models.channel.ChannelReference> distributionChannels) { 228 this.distributionChannels = distributionChannels; 229 return this; 230 } 231 232 /** 233 * <p>Distribution Channels of the Store that was created.</p> 234 * @param distributionChannels value to be set 235 * @return Builder 236 */ 237 238 public StoreCreatedMessagePayloadBuilder plusDistributionChannels( 239 final com.commercetools.api.models.channel.ChannelReference... distributionChannels) { 240 if (this.distributionChannels == null) { 241 this.distributionChannels = new ArrayList<>(); 242 } 243 this.distributionChannels.addAll(Arrays.asList(distributionChannels)); 244 return this; 245 } 246 247 /** 248 * <p>Distribution Channels of the Store that was created.</p> 249 * @param builder function to build the distributionChannels value 250 * @return Builder 251 */ 252 253 public StoreCreatedMessagePayloadBuilder plusDistributionChannels( 254 Function<com.commercetools.api.models.channel.ChannelReferenceBuilder, com.commercetools.api.models.channel.ChannelReferenceBuilder> builder) { 255 if (this.distributionChannels == null) { 256 this.distributionChannels = new ArrayList<>(); 257 } 258 this.distributionChannels 259 .add(builder.apply(com.commercetools.api.models.channel.ChannelReferenceBuilder.of()).build()); 260 return this; 261 } 262 263 /** 264 * <p>Distribution Channels of the Store that was created.</p> 265 * @param builder function to build the distributionChannels value 266 * @return Builder 267 */ 268 269 public StoreCreatedMessagePayloadBuilder withDistributionChannels( 270 Function<com.commercetools.api.models.channel.ChannelReferenceBuilder, com.commercetools.api.models.channel.ChannelReferenceBuilder> builder) { 271 this.distributionChannels = new ArrayList<>(); 272 this.distributionChannels 273 .add(builder.apply(com.commercetools.api.models.channel.ChannelReferenceBuilder.of()).build()); 274 return this; 275 } 276 277 /** 278 * <p>Distribution Channels of the Store that was created.</p> 279 * @param builder function to build the distributionChannels value 280 * @return Builder 281 */ 282 283 public StoreCreatedMessagePayloadBuilder addDistributionChannels( 284 Function<com.commercetools.api.models.channel.ChannelReferenceBuilder, com.commercetools.api.models.channel.ChannelReference> builder) { 285 return plusDistributionChannels( 286 builder.apply(com.commercetools.api.models.channel.ChannelReferenceBuilder.of())); 287 } 288 289 /** 290 * <p>Distribution Channels of the Store that was created.</p> 291 * @param builder function to build the distributionChannels value 292 * @return Builder 293 */ 294 295 public StoreCreatedMessagePayloadBuilder setDistributionChannels( 296 Function<com.commercetools.api.models.channel.ChannelReferenceBuilder, com.commercetools.api.models.channel.ChannelReference> builder) { 297 return distributionChannels(builder.apply(com.commercetools.api.models.channel.ChannelReferenceBuilder.of())); 298 } 299 300 /** 301 * <p>Supply Channels of the Store that was created.</p> 302 * @param supplyChannels value to be set 303 * @return Builder 304 */ 305 306 public StoreCreatedMessagePayloadBuilder supplyChannels( 307 final com.commercetools.api.models.channel.ChannelReference... supplyChannels) { 308 this.supplyChannels = new ArrayList<>(Arrays.asList(supplyChannels)); 309 return this; 310 } 311 312 /** 313 * <p>Supply Channels of the Store that was created.</p> 314 * @param supplyChannels value to be set 315 * @return Builder 316 */ 317 318 public StoreCreatedMessagePayloadBuilder supplyChannels( 319 final java.util.List<com.commercetools.api.models.channel.ChannelReference> supplyChannels) { 320 this.supplyChannels = supplyChannels; 321 return this; 322 } 323 324 /** 325 * <p>Supply Channels of the Store that was created.</p> 326 * @param supplyChannels value to be set 327 * @return Builder 328 */ 329 330 public StoreCreatedMessagePayloadBuilder plusSupplyChannels( 331 final com.commercetools.api.models.channel.ChannelReference... supplyChannels) { 332 if (this.supplyChannels == null) { 333 this.supplyChannels = new ArrayList<>(); 334 } 335 this.supplyChannels.addAll(Arrays.asList(supplyChannels)); 336 return this; 337 } 338 339 /** 340 * <p>Supply Channels of the Store that was created.</p> 341 * @param builder function to build the supplyChannels value 342 * @return Builder 343 */ 344 345 public StoreCreatedMessagePayloadBuilder plusSupplyChannels( 346 Function<com.commercetools.api.models.channel.ChannelReferenceBuilder, com.commercetools.api.models.channel.ChannelReferenceBuilder> builder) { 347 if (this.supplyChannels == null) { 348 this.supplyChannels = new ArrayList<>(); 349 } 350 this.supplyChannels 351 .add(builder.apply(com.commercetools.api.models.channel.ChannelReferenceBuilder.of()).build()); 352 return this; 353 } 354 355 /** 356 * <p>Supply Channels of the Store that was created.</p> 357 * @param builder function to build the supplyChannels value 358 * @return Builder 359 */ 360 361 public StoreCreatedMessagePayloadBuilder withSupplyChannels( 362 Function<com.commercetools.api.models.channel.ChannelReferenceBuilder, com.commercetools.api.models.channel.ChannelReferenceBuilder> builder) { 363 this.supplyChannels = new ArrayList<>(); 364 this.supplyChannels 365 .add(builder.apply(com.commercetools.api.models.channel.ChannelReferenceBuilder.of()).build()); 366 return this; 367 } 368 369 /** 370 * <p>Supply Channels of the Store that was created.</p> 371 * @param builder function to build the supplyChannels value 372 * @return Builder 373 */ 374 375 public StoreCreatedMessagePayloadBuilder addSupplyChannels( 376 Function<com.commercetools.api.models.channel.ChannelReferenceBuilder, com.commercetools.api.models.channel.ChannelReference> builder) { 377 return plusSupplyChannels(builder.apply(com.commercetools.api.models.channel.ChannelReferenceBuilder.of())); 378 } 379 380 /** 381 * <p>Supply Channels of the Store that was created.</p> 382 * @param builder function to build the supplyChannels value 383 * @return Builder 384 */ 385 386 public StoreCreatedMessagePayloadBuilder setSupplyChannels( 387 Function<com.commercetools.api.models.channel.ChannelReferenceBuilder, com.commercetools.api.models.channel.ChannelReference> builder) { 388 return supplyChannels(builder.apply(com.commercetools.api.models.channel.ChannelReferenceBuilder.of())); 389 } 390 391 /** 392 * <p>ProductSelectionSettings of the Store that was created.</p> 393 * @param productSelections value to be set 394 * @return Builder 395 */ 396 397 public StoreCreatedMessagePayloadBuilder productSelections( 398 final com.commercetools.api.models.store.ProductSelectionSetting... productSelections) { 399 this.productSelections = new ArrayList<>(Arrays.asList(productSelections)); 400 return this; 401 } 402 403 /** 404 * <p>ProductSelectionSettings of the Store that was created.</p> 405 * @param productSelections value to be set 406 * @return Builder 407 */ 408 409 public StoreCreatedMessagePayloadBuilder productSelections( 410 final java.util.List<com.commercetools.api.models.store.ProductSelectionSetting> productSelections) { 411 this.productSelections = productSelections; 412 return this; 413 } 414 415 /** 416 * <p>ProductSelectionSettings of the Store that was created.</p> 417 * @param productSelections value to be set 418 * @return Builder 419 */ 420 421 public StoreCreatedMessagePayloadBuilder plusProductSelections( 422 final com.commercetools.api.models.store.ProductSelectionSetting... productSelections) { 423 if (this.productSelections == null) { 424 this.productSelections = new ArrayList<>(); 425 } 426 this.productSelections.addAll(Arrays.asList(productSelections)); 427 return this; 428 } 429 430 /** 431 * <p>ProductSelectionSettings of the Store that was created.</p> 432 * @param builder function to build the productSelections value 433 * @return Builder 434 */ 435 436 public StoreCreatedMessagePayloadBuilder plusProductSelections( 437 Function<com.commercetools.api.models.store.ProductSelectionSettingBuilder, com.commercetools.api.models.store.ProductSelectionSettingBuilder> builder) { 438 if (this.productSelections == null) { 439 this.productSelections = new ArrayList<>(); 440 } 441 this.productSelections 442 .add(builder.apply(com.commercetools.api.models.store.ProductSelectionSettingBuilder.of()).build()); 443 return this; 444 } 445 446 /** 447 * <p>ProductSelectionSettings of the Store that was created.</p> 448 * @param builder function to build the productSelections value 449 * @return Builder 450 */ 451 452 public StoreCreatedMessagePayloadBuilder withProductSelections( 453 Function<com.commercetools.api.models.store.ProductSelectionSettingBuilder, com.commercetools.api.models.store.ProductSelectionSettingBuilder> builder) { 454 this.productSelections = new ArrayList<>(); 455 this.productSelections 456 .add(builder.apply(com.commercetools.api.models.store.ProductSelectionSettingBuilder.of()).build()); 457 return this; 458 } 459 460 /** 461 * <p>ProductSelectionSettings of the Store that was created.</p> 462 * @param builder function to build the productSelections value 463 * @return Builder 464 */ 465 466 public StoreCreatedMessagePayloadBuilder addProductSelections( 467 Function<com.commercetools.api.models.store.ProductSelectionSettingBuilder, com.commercetools.api.models.store.ProductSelectionSetting> builder) { 468 return plusProductSelections( 469 builder.apply(com.commercetools.api.models.store.ProductSelectionSettingBuilder.of())); 470 } 471 472 /** 473 * <p>ProductSelectionSettings of the Store that was created.</p> 474 * @param builder function to build the productSelections value 475 * @return Builder 476 */ 477 478 public StoreCreatedMessagePayloadBuilder setProductSelections( 479 Function<com.commercetools.api.models.store.ProductSelectionSettingBuilder, com.commercetools.api.models.store.ProductSelectionSetting> builder) { 480 return productSelections(builder.apply(com.commercetools.api.models.store.ProductSelectionSettingBuilder.of())); 481 } 482 483 /** 484 * <p>Custom Fields on the Store that was created.</p> 485 * @param builder function to build the custom value 486 * @return Builder 487 */ 488 489 public StoreCreatedMessagePayloadBuilder custom( 490 Function<com.commercetools.api.models.type.CustomFieldsBuilder, com.commercetools.api.models.type.CustomFieldsBuilder> builder) { 491 this.custom = builder.apply(com.commercetools.api.models.type.CustomFieldsBuilder.of()).build(); 492 return this; 493 } 494 495 /** 496 * <p>Custom Fields on the Store that was created.</p> 497 * @param builder function to build the custom value 498 * @return Builder 499 */ 500 501 public StoreCreatedMessagePayloadBuilder withCustom( 502 Function<com.commercetools.api.models.type.CustomFieldsBuilder, com.commercetools.api.models.type.CustomFields> builder) { 503 this.custom = builder.apply(com.commercetools.api.models.type.CustomFieldsBuilder.of()); 504 return this; 505 } 506 507 /** 508 * <p>Custom Fields on the Store that was created.</p> 509 * @param custom value to be set 510 * @return Builder 511 */ 512 513 public StoreCreatedMessagePayloadBuilder custom( 514 @Nullable final com.commercetools.api.models.type.CustomFields custom) { 515 this.custom = custom; 516 return this; 517 } 518 519 /** 520 * <p>The <code>name</code> of the Store that was created.</p> 521 * @return name 522 */ 523 524 @Nullable 525 public com.commercetools.api.models.common.LocalizedString getName() { 526 return this.name; 527 } 528 529 /** 530 * <p>Languages of the Store that was created. Languages are represented as IETF language tags.</p> 531 * @return languages 532 */ 533 534 @Nullable 535 public java.util.List<String> getLanguages() { 536 return this.languages; 537 } 538 539 /** 540 * <p>Countries of the Store that was created.</p> 541 * @return countries 542 */ 543 544 @Nullable 545 public java.util.List<com.commercetools.api.models.store_country.StoreCountry> getCountries() { 546 return this.countries; 547 } 548 549 /** 550 * <p>Distribution Channels of the Store that was created.</p> 551 * @return distributionChannels 552 */ 553 554 public java.util.List<com.commercetools.api.models.channel.ChannelReference> getDistributionChannels() { 555 return this.distributionChannels; 556 } 557 558 /** 559 * <p>Supply Channels of the Store that was created.</p> 560 * @return supplyChannels 561 */ 562 563 public java.util.List<com.commercetools.api.models.channel.ChannelReference> getSupplyChannels() { 564 return this.supplyChannels; 565 } 566 567 /** 568 * <p>ProductSelectionSettings of the Store that was created.</p> 569 * @return productSelections 570 */ 571 572 public java.util.List<com.commercetools.api.models.store.ProductSelectionSetting> getProductSelections() { 573 return this.productSelections; 574 } 575 576 /** 577 * <p>Custom Fields on the Store that was created.</p> 578 * @return custom 579 */ 580 581 @Nullable 582 public com.commercetools.api.models.type.CustomFields getCustom() { 583 return this.custom; 584 } 585 586 /** 587 * builds StoreCreatedMessagePayload with checking for non-null required values 588 * @return StoreCreatedMessagePayload 589 */ 590 public StoreCreatedMessagePayload build() { 591 Objects.requireNonNull(distributionChannels, 592 StoreCreatedMessagePayload.class + ": distributionChannels is missing"); 593 Objects.requireNonNull(supplyChannels, StoreCreatedMessagePayload.class + ": supplyChannels is missing"); 594 Objects.requireNonNull(productSelections, StoreCreatedMessagePayload.class + ": productSelections is missing"); 595 return new StoreCreatedMessagePayloadImpl(name, languages, countries, distributionChannels, supplyChannels, 596 productSelections, custom); 597 } 598 599 /** 600 * builds StoreCreatedMessagePayload without checking for non-null required values 601 * @return StoreCreatedMessagePayload 602 */ 603 public StoreCreatedMessagePayload buildUnchecked() { 604 return new StoreCreatedMessagePayloadImpl(name, languages, countries, distributionChannels, supplyChannels, 605 productSelections, custom); 606 } 607 608 /** 609 * factory method for an instance of StoreCreatedMessagePayloadBuilder 610 * @return builder 611 */ 612 public static StoreCreatedMessagePayloadBuilder of() { 613 return new StoreCreatedMessagePayloadBuilder(); 614 } 615 616 /** 617 * create builder for StoreCreatedMessagePayload instance 618 * @param template instance with prefilled values for the builder 619 * @return builder 620 */ 621 public static StoreCreatedMessagePayloadBuilder of(final StoreCreatedMessagePayload template) { 622 StoreCreatedMessagePayloadBuilder builder = new StoreCreatedMessagePayloadBuilder(); 623 builder.name = template.getName(); 624 builder.languages = template.getLanguages(); 625 builder.countries = template.getCountries(); 626 builder.distributionChannels = template.getDistributionChannels(); 627 builder.supplyChannels = template.getSupplyChannels(); 628 builder.productSelections = template.getProductSelections(); 629 builder.custom = template.getCustom(); 630 return builder; 631 } 632 633}