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 * ParcelAddedToDeliveryMessageBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * ParcelAddedToDeliveryMessage parcelAddedToDeliveryMessage = ParcelAddedToDeliveryMessage.builder() 019 * .id("{id}") 020 * .version(0.3) 021 * .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z")) 022 * .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z")) 023 * .sequenceNumber(0.3) 024 * .resource(resourceBuilder -> resourceBuilder) 025 * .resourceVersion(0.3) 026 * .delivery(deliveryBuilder -> deliveryBuilder) 027 * .parcel(parcelBuilder -> parcelBuilder) 028 * .build() 029 * </code></pre> 030 * </div> 031 */ 032@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 033public class ParcelAddedToDeliveryMessageBuilder implements Builder<ParcelAddedToDeliveryMessage> { 034 035 private String id; 036 037 private Long version; 038 039 private java.time.ZonedDateTime createdAt; 040 041 private java.time.ZonedDateTime lastModifiedAt; 042 043 @Nullable 044 private com.commercetools.api.models.common.LastModifiedBy lastModifiedBy; 045 046 @Nullable 047 private com.commercetools.api.models.common.CreatedBy createdBy; 048 049 private Long sequenceNumber; 050 051 private com.commercetools.api.models.common.Reference resource; 052 053 private Long resourceVersion; 054 055 @Nullable 056 private com.commercetools.api.models.message.UserProvidedIdentifiers resourceUserProvidedIdentifiers; 057 058 private com.commercetools.api.models.order.Delivery delivery; 059 060 private com.commercetools.api.models.order.Parcel parcel; 061 062 @Nullable 063 private String shippingKey; 064 065 /** 066 * <p>Unique identifier of the Message. Can be used to track which Messages have been processed.</p> 067 * @param id value to be set 068 * @return Builder 069 */ 070 071 public ParcelAddedToDeliveryMessageBuilder id(final String id) { 072 this.id = id; 073 return this; 074 } 075 076 /** 077 * <p>Version of a resource. In case of Messages, this is always <code>1</code>.</p> 078 * @param version value to be set 079 * @return Builder 080 */ 081 082 public ParcelAddedToDeliveryMessageBuilder version(final Long version) { 083 this.version = version; 084 return this; 085 } 086 087 /** 088 * <p>Date and time (UTC) the Message was generated.</p> 089 * @param createdAt value to be set 090 * @return Builder 091 */ 092 093 public ParcelAddedToDeliveryMessageBuilder createdAt(final java.time.ZonedDateTime createdAt) { 094 this.createdAt = createdAt; 095 return this; 096 } 097 098 /** 099 * <p>Value of <code>createdAt</code>.</p> 100 * @param lastModifiedAt value to be set 101 * @return Builder 102 */ 103 104 public ParcelAddedToDeliveryMessageBuilder lastModifiedAt(final java.time.ZonedDateTime lastModifiedAt) { 105 this.lastModifiedAt = lastModifiedAt; 106 return this; 107 } 108 109 /** 110 * <p>Value of <code>createdBy</code>.</p> 111 * @param builder function to build the lastModifiedBy value 112 * @return Builder 113 */ 114 115 public ParcelAddedToDeliveryMessageBuilder lastModifiedBy( 116 Function<com.commercetools.api.models.common.LastModifiedByBuilder, com.commercetools.api.models.common.LastModifiedByBuilder> builder) { 117 this.lastModifiedBy = builder.apply(com.commercetools.api.models.common.LastModifiedByBuilder.of()).build(); 118 return this; 119 } 120 121 /** 122 * <p>Value of <code>createdBy</code>.</p> 123 * @param builder function to build the lastModifiedBy value 124 * @return Builder 125 */ 126 127 public ParcelAddedToDeliveryMessageBuilder withLastModifiedBy( 128 Function<com.commercetools.api.models.common.LastModifiedByBuilder, com.commercetools.api.models.common.LastModifiedBy> builder) { 129 this.lastModifiedBy = builder.apply(com.commercetools.api.models.common.LastModifiedByBuilder.of()); 130 return this; 131 } 132 133 /** 134 * <p>Value of <code>createdBy</code>.</p> 135 * @param lastModifiedBy value to be set 136 * @return Builder 137 */ 138 139 public ParcelAddedToDeliveryMessageBuilder lastModifiedBy( 140 @Nullable final com.commercetools.api.models.common.LastModifiedBy lastModifiedBy) { 141 this.lastModifiedBy = lastModifiedBy; 142 return this; 143 } 144 145 /** 146 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 147 * @param builder function to build the createdBy value 148 * @return Builder 149 */ 150 151 public ParcelAddedToDeliveryMessageBuilder createdBy( 152 Function<com.commercetools.api.models.common.CreatedByBuilder, com.commercetools.api.models.common.CreatedByBuilder> builder) { 153 this.createdBy = builder.apply(com.commercetools.api.models.common.CreatedByBuilder.of()).build(); 154 return this; 155 } 156 157 /** 158 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 159 * @param builder function to build the createdBy value 160 * @return Builder 161 */ 162 163 public ParcelAddedToDeliveryMessageBuilder withCreatedBy( 164 Function<com.commercetools.api.models.common.CreatedByBuilder, com.commercetools.api.models.common.CreatedBy> builder) { 165 this.createdBy = builder.apply(com.commercetools.api.models.common.CreatedByBuilder.of()); 166 return this; 167 } 168 169 /** 170 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 171 * @param createdBy value to be set 172 * @return Builder 173 */ 174 175 public ParcelAddedToDeliveryMessageBuilder createdBy( 176 @Nullable final com.commercetools.api.models.common.CreatedBy createdBy) { 177 this.createdBy = createdBy; 178 return this; 179 } 180 181 /** 182 * <p>Message number in relation to other Messages for a given resource. The <code>sequenceNumber</code> of the next Message for the resource is the successor of the <code>sequenceNumber</code> of the current Message. Meaning, the <code>sequenceNumber</code> of the next Message equals the <code>sequenceNumber</code> of the current Message + 1. <code>sequenceNumber</code> can be used to ensure that Messages are processed in the correct order for a particular resource.</p> 183 * @param sequenceNumber value to be set 184 * @return Builder 185 */ 186 187 public ParcelAddedToDeliveryMessageBuilder sequenceNumber(final Long sequenceNumber) { 188 this.sequenceNumber = sequenceNumber; 189 return this; 190 } 191 192 /** 193 * <p>Reference to the resource on which the change or action was performed.</p> 194 * @param resource value to be set 195 * @return Builder 196 */ 197 198 public ParcelAddedToDeliveryMessageBuilder resource(final com.commercetools.api.models.common.Reference resource) { 199 this.resource = resource; 200 return this; 201 } 202 203 /** 204 * <p>Reference to the resource on which the change or action was performed.</p> 205 * @param builder function to build the resource value 206 * @return Builder 207 */ 208 209 public ParcelAddedToDeliveryMessageBuilder resource( 210 Function<com.commercetools.api.models.common.ReferenceBuilder, Builder<? extends com.commercetools.api.models.common.Reference>> builder) { 211 this.resource = builder.apply(com.commercetools.api.models.common.ReferenceBuilder.of()).build(); 212 return this; 213 } 214 215 /** 216 * <p>Version of the resource on which the change or action was performed.</p> 217 * @param resourceVersion value to be set 218 * @return Builder 219 */ 220 221 public ParcelAddedToDeliveryMessageBuilder resourceVersion(final Long resourceVersion) { 222 this.resourceVersion = resourceVersion; 223 return this; 224 } 225 226 /** 227 * <p>User-provided identifiers of the resource, such as <code>key</code> or <code>externalId</code>. Only present if the resource has such identifiers.</p> 228 * @param builder function to build the resourceUserProvidedIdentifiers value 229 * @return Builder 230 */ 231 232 public ParcelAddedToDeliveryMessageBuilder resourceUserProvidedIdentifiers( 233 Function<com.commercetools.api.models.message.UserProvidedIdentifiersBuilder, com.commercetools.api.models.message.UserProvidedIdentifiersBuilder> builder) { 234 this.resourceUserProvidedIdentifiers = builder 235 .apply(com.commercetools.api.models.message.UserProvidedIdentifiersBuilder.of()) 236 .build(); 237 return this; 238 } 239 240 /** 241 * <p>User-provided identifiers of the resource, such as <code>key</code> or <code>externalId</code>. Only present if the resource has such identifiers.</p> 242 * @param builder function to build the resourceUserProvidedIdentifiers value 243 * @return Builder 244 */ 245 246 public ParcelAddedToDeliveryMessageBuilder withResourceUserProvidedIdentifiers( 247 Function<com.commercetools.api.models.message.UserProvidedIdentifiersBuilder, com.commercetools.api.models.message.UserProvidedIdentifiers> builder) { 248 this.resourceUserProvidedIdentifiers = builder 249 .apply(com.commercetools.api.models.message.UserProvidedIdentifiersBuilder.of()); 250 return this; 251 } 252 253 /** 254 * <p>User-provided identifiers of the resource, such as <code>key</code> or <code>externalId</code>. Only present if the resource has such identifiers.</p> 255 * @param resourceUserProvidedIdentifiers value to be set 256 * @return Builder 257 */ 258 259 public ParcelAddedToDeliveryMessageBuilder resourceUserProvidedIdentifiers( 260 @Nullable final com.commercetools.api.models.message.UserProvidedIdentifiers resourceUserProvidedIdentifiers) { 261 this.resourceUserProvidedIdentifiers = resourceUserProvidedIdentifiers; 262 return this; 263 } 264 265 /** 266 * <p>Unique identifier of the Delivery.</p> 267 * @param builder function to build the delivery value 268 * @return Builder 269 */ 270 271 public ParcelAddedToDeliveryMessageBuilder delivery( 272 Function<com.commercetools.api.models.order.DeliveryBuilder, com.commercetools.api.models.order.DeliveryBuilder> builder) { 273 this.delivery = builder.apply(com.commercetools.api.models.order.DeliveryBuilder.of()).build(); 274 return this; 275 } 276 277 /** 278 * <p>Unique identifier of the Delivery.</p> 279 * @param builder function to build the delivery value 280 * @return Builder 281 */ 282 283 public ParcelAddedToDeliveryMessageBuilder withDelivery( 284 Function<com.commercetools.api.models.order.DeliveryBuilder, com.commercetools.api.models.order.Delivery> builder) { 285 this.delivery = builder.apply(com.commercetools.api.models.order.DeliveryBuilder.of()); 286 return this; 287 } 288 289 /** 290 * <p>Unique identifier of the Delivery.</p> 291 * @param delivery value to be set 292 * @return Builder 293 */ 294 295 public ParcelAddedToDeliveryMessageBuilder delivery(final com.commercetools.api.models.order.Delivery delivery) { 296 this.delivery = delivery; 297 return this; 298 } 299 300 /** 301 * <p>Parcel that was added to the Delivery.</p> 302 * @param builder function to build the parcel value 303 * @return Builder 304 */ 305 306 public ParcelAddedToDeliveryMessageBuilder parcel( 307 Function<com.commercetools.api.models.order.ParcelBuilder, com.commercetools.api.models.order.ParcelBuilder> builder) { 308 this.parcel = builder.apply(com.commercetools.api.models.order.ParcelBuilder.of()).build(); 309 return this; 310 } 311 312 /** 313 * <p>Parcel that was added to the Delivery.</p> 314 * @param builder function to build the parcel value 315 * @return Builder 316 */ 317 318 public ParcelAddedToDeliveryMessageBuilder withParcel( 319 Function<com.commercetools.api.models.order.ParcelBuilder, com.commercetools.api.models.order.Parcel> builder) { 320 this.parcel = builder.apply(com.commercetools.api.models.order.ParcelBuilder.of()); 321 return this; 322 } 323 324 /** 325 * <p>Parcel that was added to the Delivery.</p> 326 * @param parcel value to be set 327 * @return Builder 328 */ 329 330 public ParcelAddedToDeliveryMessageBuilder parcel(final com.commercetools.api.models.order.Parcel parcel) { 331 this.parcel = parcel; 332 return this; 333 } 334 335 /** 336 * <p>User-defined unique identifier of the Shipping Method in a Cart with <code>Multiple</code> ShippingMode.</p> 337 * @param shippingKey value to be set 338 * @return Builder 339 */ 340 341 public ParcelAddedToDeliveryMessageBuilder shippingKey(@Nullable final String shippingKey) { 342 this.shippingKey = shippingKey; 343 return this; 344 } 345 346 /** 347 * <p>Unique identifier of the Message. Can be used to track which Messages have been processed.</p> 348 * @return id 349 */ 350 351 public String getId() { 352 return this.id; 353 } 354 355 /** 356 * <p>Version of a resource. In case of Messages, this is always <code>1</code>.</p> 357 * @return version 358 */ 359 360 public Long getVersion() { 361 return this.version; 362 } 363 364 /** 365 * <p>Date and time (UTC) the Message was generated.</p> 366 * @return createdAt 367 */ 368 369 public java.time.ZonedDateTime getCreatedAt() { 370 return this.createdAt; 371 } 372 373 /** 374 * <p>Value of <code>createdAt</code>.</p> 375 * @return lastModifiedAt 376 */ 377 378 public java.time.ZonedDateTime getLastModifiedAt() { 379 return this.lastModifiedAt; 380 } 381 382 /** 383 * <p>Value of <code>createdBy</code>.</p> 384 * @return lastModifiedBy 385 */ 386 387 @Nullable 388 public com.commercetools.api.models.common.LastModifiedBy getLastModifiedBy() { 389 return this.lastModifiedBy; 390 } 391 392 /** 393 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 394 * @return createdBy 395 */ 396 397 @Nullable 398 public com.commercetools.api.models.common.CreatedBy getCreatedBy() { 399 return this.createdBy; 400 } 401 402 /** 403 * <p>Message number in relation to other Messages for a given resource. The <code>sequenceNumber</code> of the next Message for the resource is the successor of the <code>sequenceNumber</code> of the current Message. Meaning, the <code>sequenceNumber</code> of the next Message equals the <code>sequenceNumber</code> of the current Message + 1. <code>sequenceNumber</code> can be used to ensure that Messages are processed in the correct order for a particular resource.</p> 404 * @return sequenceNumber 405 */ 406 407 public Long getSequenceNumber() { 408 return this.sequenceNumber; 409 } 410 411 /** 412 * <p>Reference to the resource on which the change or action was performed.</p> 413 * @return resource 414 */ 415 416 public com.commercetools.api.models.common.Reference getResource() { 417 return this.resource; 418 } 419 420 /** 421 * <p>Version of the resource on which the change or action was performed.</p> 422 * @return resourceVersion 423 */ 424 425 public Long getResourceVersion() { 426 return this.resourceVersion; 427 } 428 429 /** 430 * <p>User-provided identifiers of the resource, such as <code>key</code> or <code>externalId</code>. Only present if the resource has such identifiers.</p> 431 * @return resourceUserProvidedIdentifiers 432 */ 433 434 @Nullable 435 public com.commercetools.api.models.message.UserProvidedIdentifiers getResourceUserProvidedIdentifiers() { 436 return this.resourceUserProvidedIdentifiers; 437 } 438 439 /** 440 * <p>Unique identifier of the Delivery.</p> 441 * @return delivery 442 */ 443 444 public com.commercetools.api.models.order.Delivery getDelivery() { 445 return this.delivery; 446 } 447 448 /** 449 * <p>Parcel that was added to the Delivery.</p> 450 * @return parcel 451 */ 452 453 public com.commercetools.api.models.order.Parcel getParcel() { 454 return this.parcel; 455 } 456 457 /** 458 * <p>User-defined unique identifier of the Shipping Method in a Cart with <code>Multiple</code> ShippingMode.</p> 459 * @return shippingKey 460 */ 461 462 @Nullable 463 public String getShippingKey() { 464 return this.shippingKey; 465 } 466 467 /** 468 * builds ParcelAddedToDeliveryMessage with checking for non-null required values 469 * @return ParcelAddedToDeliveryMessage 470 */ 471 public ParcelAddedToDeliveryMessage build() { 472 Objects.requireNonNull(id, ParcelAddedToDeliveryMessage.class + ": id is missing"); 473 Objects.requireNonNull(version, ParcelAddedToDeliveryMessage.class + ": version is missing"); 474 Objects.requireNonNull(createdAt, ParcelAddedToDeliveryMessage.class + ": createdAt is missing"); 475 Objects.requireNonNull(lastModifiedAt, ParcelAddedToDeliveryMessage.class + ": lastModifiedAt is missing"); 476 Objects.requireNonNull(sequenceNumber, ParcelAddedToDeliveryMessage.class + ": sequenceNumber is missing"); 477 Objects.requireNonNull(resource, ParcelAddedToDeliveryMessage.class + ": resource is missing"); 478 Objects.requireNonNull(resourceVersion, ParcelAddedToDeliveryMessage.class + ": resourceVersion is missing"); 479 Objects.requireNonNull(delivery, ParcelAddedToDeliveryMessage.class + ": delivery is missing"); 480 Objects.requireNonNull(parcel, ParcelAddedToDeliveryMessage.class + ": parcel is missing"); 481 return new ParcelAddedToDeliveryMessageImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy, createdBy, 482 sequenceNumber, resource, resourceVersion, resourceUserProvidedIdentifiers, delivery, parcel, shippingKey); 483 } 484 485 /** 486 * builds ParcelAddedToDeliveryMessage without checking for non-null required values 487 * @return ParcelAddedToDeliveryMessage 488 */ 489 public ParcelAddedToDeliveryMessage buildUnchecked() { 490 return new ParcelAddedToDeliveryMessageImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy, createdBy, 491 sequenceNumber, resource, resourceVersion, resourceUserProvidedIdentifiers, delivery, parcel, shippingKey); 492 } 493 494 /** 495 * factory method for an instance of ParcelAddedToDeliveryMessageBuilder 496 * @return builder 497 */ 498 public static ParcelAddedToDeliveryMessageBuilder of() { 499 return new ParcelAddedToDeliveryMessageBuilder(); 500 } 501 502 /** 503 * create builder for ParcelAddedToDeliveryMessage instance 504 * @param template instance with prefilled values for the builder 505 * @return builder 506 */ 507 public static ParcelAddedToDeliveryMessageBuilder of(final ParcelAddedToDeliveryMessage template) { 508 ParcelAddedToDeliveryMessageBuilder builder = new ParcelAddedToDeliveryMessageBuilder(); 509 builder.id = template.getId(); 510 builder.version = template.getVersion(); 511 builder.createdAt = template.getCreatedAt(); 512 builder.lastModifiedAt = template.getLastModifiedAt(); 513 builder.lastModifiedBy = template.getLastModifiedBy(); 514 builder.createdBy = template.getCreatedBy(); 515 builder.sequenceNumber = template.getSequenceNumber(); 516 builder.resource = template.getResource(); 517 builder.resourceVersion = template.getResourceVersion(); 518 builder.resourceUserProvidedIdentifiers = template.getResourceUserProvidedIdentifiers(); 519 builder.delivery = template.getDelivery(); 520 builder.parcel = template.getParcel(); 521 builder.shippingKey = template.getShippingKey(); 522 return builder; 523 } 524 525}