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