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