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 * OrderPaymentStateChangedMessageBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * OrderPaymentStateChangedMessage orderPaymentStateChangedMessage = OrderPaymentStateChangedMessage.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 * .paymentState(PaymentState.BALANCE_DUE) 027 * .build() 028 * </code></pre> 029 * </div> 030 */ 031@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 032public class OrderPaymentStateChangedMessageBuilder implements Builder<OrderPaymentStateChangedMessage> { 033 034 private String id; 035 036 private Long version; 037 038 private java.time.ZonedDateTime createdAt; 039 040 private java.time.ZonedDateTime lastModifiedAt; 041 042 @Nullable 043 private com.commercetools.api.models.common.LastModifiedBy lastModifiedBy; 044 045 @Nullable 046 private com.commercetools.api.models.common.CreatedBy createdBy; 047 048 private Long sequenceNumber; 049 050 private com.commercetools.api.models.common.Reference resource; 051 052 private Long resourceVersion; 053 054 @Nullable 055 private com.commercetools.api.models.message.UserProvidedIdentifiers resourceUserProvidedIdentifiers; 056 057 private com.commercetools.api.models.order.PaymentState paymentState; 058 059 @Nullable 060 private com.commercetools.api.models.order.PaymentState oldPaymentState; 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 OrderPaymentStateChangedMessageBuilder 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 OrderPaymentStateChangedMessageBuilder 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 OrderPaymentStateChangedMessageBuilder 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 OrderPaymentStateChangedMessageBuilder 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 OrderPaymentStateChangedMessageBuilder 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 OrderPaymentStateChangedMessageBuilder 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 OrderPaymentStateChangedMessageBuilder 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 OrderPaymentStateChangedMessageBuilder 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 OrderPaymentStateChangedMessageBuilder 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 OrderPaymentStateChangedMessageBuilder 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 OrderPaymentStateChangedMessageBuilder 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 OrderPaymentStateChangedMessageBuilder 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 OrderPaymentStateChangedMessageBuilder 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 OrderPaymentStateChangedMessageBuilder 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 OrderPaymentStateChangedMessageBuilder 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 OrderPaymentStateChangedMessageBuilder 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 OrderPaymentStateChangedMessageBuilder resourceUserProvidedIdentifiers( 258 @Nullable final com.commercetools.api.models.message.UserProvidedIdentifiers resourceUserProvidedIdentifiers) { 259 this.resourceUserProvidedIdentifiers = resourceUserProvidedIdentifiers; 260 return this; 261 } 262 263 /** 264 * <p>PaymentState after the Change Payment State update action.</p> 265 * @param paymentState value to be set 266 * @return Builder 267 */ 268 269 public OrderPaymentStateChangedMessageBuilder paymentState( 270 final com.commercetools.api.models.order.PaymentState paymentState) { 271 this.paymentState = paymentState; 272 return this; 273 } 274 275 /** 276 * <p>PaymentState before the Change Payment State update action.</p> 277 * @param oldPaymentState value to be set 278 * @return Builder 279 */ 280 281 public OrderPaymentStateChangedMessageBuilder oldPaymentState( 282 @Nullable final com.commercetools.api.models.order.PaymentState oldPaymentState) { 283 this.oldPaymentState = oldPaymentState; 284 return this; 285 } 286 287 /** 288 * <p>Unique identifier of the Message. Can be used to track which Messages have been processed.</p> 289 * @return id 290 */ 291 292 public String getId() { 293 return this.id; 294 } 295 296 /** 297 * <p>Version of a resource. In case of Messages, this is always <code>1</code>.</p> 298 * @return version 299 */ 300 301 public Long getVersion() { 302 return this.version; 303 } 304 305 /** 306 * <p>Date and time (UTC) the Message was generated.</p> 307 * @return createdAt 308 */ 309 310 public java.time.ZonedDateTime getCreatedAt() { 311 return this.createdAt; 312 } 313 314 /** 315 * <p>Value of <code>createdAt</code>.</p> 316 * @return lastModifiedAt 317 */ 318 319 public java.time.ZonedDateTime getLastModifiedAt() { 320 return this.lastModifiedAt; 321 } 322 323 /** 324 * <p>Value of <code>createdBy</code>.</p> 325 * @return lastModifiedBy 326 */ 327 328 @Nullable 329 public com.commercetools.api.models.common.LastModifiedBy getLastModifiedBy() { 330 return this.lastModifiedBy; 331 } 332 333 /** 334 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 335 * @return createdBy 336 */ 337 338 @Nullable 339 public com.commercetools.api.models.common.CreatedBy getCreatedBy() { 340 return this.createdBy; 341 } 342 343 /** 344 * <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> 345 * @return sequenceNumber 346 */ 347 348 public Long getSequenceNumber() { 349 return this.sequenceNumber; 350 } 351 352 /** 353 * <p>Reference to the resource on which the change or action was performed.</p> 354 * @return resource 355 */ 356 357 public com.commercetools.api.models.common.Reference getResource() { 358 return this.resource; 359 } 360 361 /** 362 * <p>Version of the resource on which the change or action was performed.</p> 363 * @return resourceVersion 364 */ 365 366 public Long getResourceVersion() { 367 return this.resourceVersion; 368 } 369 370 /** 371 * <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> 372 * @return resourceUserProvidedIdentifiers 373 */ 374 375 @Nullable 376 public com.commercetools.api.models.message.UserProvidedIdentifiers getResourceUserProvidedIdentifiers() { 377 return this.resourceUserProvidedIdentifiers; 378 } 379 380 /** 381 * <p>PaymentState after the Change Payment State update action.</p> 382 * @return paymentState 383 */ 384 385 public com.commercetools.api.models.order.PaymentState getPaymentState() { 386 return this.paymentState; 387 } 388 389 /** 390 * <p>PaymentState before the Change Payment State update action.</p> 391 * @return oldPaymentState 392 */ 393 394 @Nullable 395 public com.commercetools.api.models.order.PaymentState getOldPaymentState() { 396 return this.oldPaymentState; 397 } 398 399 /** 400 * builds OrderPaymentStateChangedMessage with checking for non-null required values 401 * @return OrderPaymentStateChangedMessage 402 */ 403 public OrderPaymentStateChangedMessage build() { 404 Objects.requireNonNull(id, OrderPaymentStateChangedMessage.class + ": id is missing"); 405 Objects.requireNonNull(version, OrderPaymentStateChangedMessage.class + ": version is missing"); 406 Objects.requireNonNull(createdAt, OrderPaymentStateChangedMessage.class + ": createdAt is missing"); 407 Objects.requireNonNull(lastModifiedAt, OrderPaymentStateChangedMessage.class + ": lastModifiedAt is missing"); 408 Objects.requireNonNull(sequenceNumber, OrderPaymentStateChangedMessage.class + ": sequenceNumber is missing"); 409 Objects.requireNonNull(resource, OrderPaymentStateChangedMessage.class + ": resource is missing"); 410 Objects.requireNonNull(resourceVersion, OrderPaymentStateChangedMessage.class + ": resourceVersion is missing"); 411 Objects.requireNonNull(paymentState, OrderPaymentStateChangedMessage.class + ": paymentState is missing"); 412 return new OrderPaymentStateChangedMessageImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy, 413 createdBy, sequenceNumber, resource, resourceVersion, resourceUserProvidedIdentifiers, paymentState, 414 oldPaymentState); 415 } 416 417 /** 418 * builds OrderPaymentStateChangedMessage without checking for non-null required values 419 * @return OrderPaymentStateChangedMessage 420 */ 421 public OrderPaymentStateChangedMessage buildUnchecked() { 422 return new OrderPaymentStateChangedMessageImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy, 423 createdBy, sequenceNumber, resource, resourceVersion, resourceUserProvidedIdentifiers, paymentState, 424 oldPaymentState); 425 } 426 427 /** 428 * factory method for an instance of OrderPaymentStateChangedMessageBuilder 429 * @return builder 430 */ 431 public static OrderPaymentStateChangedMessageBuilder of() { 432 return new OrderPaymentStateChangedMessageBuilder(); 433 } 434 435 /** 436 * create builder for OrderPaymentStateChangedMessage instance 437 * @param template instance with prefilled values for the builder 438 * @return builder 439 */ 440 public static OrderPaymentStateChangedMessageBuilder of(final OrderPaymentStateChangedMessage template) { 441 OrderPaymentStateChangedMessageBuilder builder = new OrderPaymentStateChangedMessageBuilder(); 442 builder.id = template.getId(); 443 builder.version = template.getVersion(); 444 builder.createdAt = template.getCreatedAt(); 445 builder.lastModifiedAt = template.getLastModifiedAt(); 446 builder.lastModifiedBy = template.getLastModifiedBy(); 447 builder.createdBy = template.getCreatedBy(); 448 builder.sequenceNumber = template.getSequenceNumber(); 449 builder.resource = template.getResource(); 450 builder.resourceVersion = template.getResourceVersion(); 451 builder.resourceUserProvidedIdentifiers = template.getResourceUserProvidedIdentifiers(); 452 builder.paymentState = template.getPaymentState(); 453 builder.oldPaymentState = template.getOldPaymentState(); 454 return builder; 455 } 456 457}