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 * OrderStoreSetMessageBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * OrderStoreSetMessage orderStoreSetMessage = OrderStoreSetMessage.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 OrderStoreSetMessageBuilder implements Builder<OrderStoreSetMessage> { 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.store.StoreKeyReference store; 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 OrderStoreSetMessageBuilder 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 OrderStoreSetMessageBuilder 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 OrderStoreSetMessageBuilder 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 OrderStoreSetMessageBuilder 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 OrderStoreSetMessageBuilder 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 OrderStoreSetMessageBuilder 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 OrderStoreSetMessageBuilder 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 OrderStoreSetMessageBuilder 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 OrderStoreSetMessageBuilder 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 OrderStoreSetMessageBuilder 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 OrderStoreSetMessageBuilder 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 OrderStoreSetMessageBuilder resource(final com.commercetools.api.models.common.Reference resource) { 193 this.resource = resource; 194 return this; 195 } 196 197 /** 198 * <p>Reference to the resource on which the change or action was performed.</p> 199 * @param builder function to build the resource value 200 * @return Builder 201 */ 202 203 public OrderStoreSetMessageBuilder resource( 204 Function<com.commercetools.api.models.common.ReferenceBuilder, Builder<? extends com.commercetools.api.models.common.Reference>> builder) { 205 this.resource = builder.apply(com.commercetools.api.models.common.ReferenceBuilder.of()).build(); 206 return this; 207 } 208 209 /** 210 * <p>Version of the resource on which the change or action was performed.</p> 211 * @param resourceVersion value to be set 212 * @return Builder 213 */ 214 215 public OrderStoreSetMessageBuilder resourceVersion(final Long resourceVersion) { 216 this.resourceVersion = resourceVersion; 217 return this; 218 } 219 220 /** 221 * <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> 222 * @param builder function to build the resourceUserProvidedIdentifiers value 223 * @return Builder 224 */ 225 226 public OrderStoreSetMessageBuilder resourceUserProvidedIdentifiers( 227 Function<com.commercetools.api.models.message.UserProvidedIdentifiersBuilder, com.commercetools.api.models.message.UserProvidedIdentifiersBuilder> builder) { 228 this.resourceUserProvidedIdentifiers = builder 229 .apply(com.commercetools.api.models.message.UserProvidedIdentifiersBuilder.of()) 230 .build(); 231 return this; 232 } 233 234 /** 235 * <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> 236 * @param builder function to build the resourceUserProvidedIdentifiers value 237 * @return Builder 238 */ 239 240 public OrderStoreSetMessageBuilder withResourceUserProvidedIdentifiers( 241 Function<com.commercetools.api.models.message.UserProvidedIdentifiersBuilder, com.commercetools.api.models.message.UserProvidedIdentifiers> builder) { 242 this.resourceUserProvidedIdentifiers = builder 243 .apply(com.commercetools.api.models.message.UserProvidedIdentifiersBuilder.of()); 244 return this; 245 } 246 247 /** 248 * <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> 249 * @param resourceUserProvidedIdentifiers value to be set 250 * @return Builder 251 */ 252 253 public OrderStoreSetMessageBuilder resourceUserProvidedIdentifiers( 254 @Nullable final com.commercetools.api.models.message.UserProvidedIdentifiers resourceUserProvidedIdentifiers) { 255 this.resourceUserProvidedIdentifiers = resourceUserProvidedIdentifiers; 256 return this; 257 } 258 259 /** 260 * <p>Store that was set.</p> 261 * @param builder function to build the store value 262 * @return Builder 263 */ 264 265 public OrderStoreSetMessageBuilder store( 266 Function<com.commercetools.api.models.store.StoreKeyReferenceBuilder, com.commercetools.api.models.store.StoreKeyReferenceBuilder> builder) { 267 this.store = builder.apply(com.commercetools.api.models.store.StoreKeyReferenceBuilder.of()).build(); 268 return this; 269 } 270 271 /** 272 * <p>Store that was set.</p> 273 * @param builder function to build the store value 274 * @return Builder 275 */ 276 277 public OrderStoreSetMessageBuilder withStore( 278 Function<com.commercetools.api.models.store.StoreKeyReferenceBuilder, com.commercetools.api.models.store.StoreKeyReference> builder) { 279 this.store = builder.apply(com.commercetools.api.models.store.StoreKeyReferenceBuilder.of()); 280 return this; 281 } 282 283 /** 284 * <p>Store that was set.</p> 285 * @param store value to be set 286 * @return Builder 287 */ 288 289 public OrderStoreSetMessageBuilder store( 290 @Nullable final com.commercetools.api.models.store.StoreKeyReference store) { 291 this.store = store; 292 return this; 293 } 294 295 /** 296 * <p>Unique identifier of the Message. Can be used to track which Messages have been processed.</p> 297 * @return id 298 */ 299 300 public String getId() { 301 return this.id; 302 } 303 304 /** 305 * <p>Version of a resource. In case of Messages, this is always <code>1</code>.</p> 306 * @return version 307 */ 308 309 public Long getVersion() { 310 return this.version; 311 } 312 313 /** 314 * <p>Date and time (UTC) the Message was generated.</p> 315 * @return createdAt 316 */ 317 318 public java.time.ZonedDateTime getCreatedAt() { 319 return this.createdAt; 320 } 321 322 /** 323 * <p>Value of <code>createdAt</code>.</p> 324 * @return lastModifiedAt 325 */ 326 327 public java.time.ZonedDateTime getLastModifiedAt() { 328 return this.lastModifiedAt; 329 } 330 331 /** 332 * <p>Value of <code>createdBy</code>.</p> 333 * @return lastModifiedBy 334 */ 335 336 @Nullable 337 public com.commercetools.api.models.common.LastModifiedBy getLastModifiedBy() { 338 return this.lastModifiedBy; 339 } 340 341 /** 342 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 343 * @return createdBy 344 */ 345 346 @Nullable 347 public com.commercetools.api.models.common.CreatedBy getCreatedBy() { 348 return this.createdBy; 349 } 350 351 /** 352 * <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> 353 * @return sequenceNumber 354 */ 355 356 public Long getSequenceNumber() { 357 return this.sequenceNumber; 358 } 359 360 /** 361 * <p>Reference to the resource on which the change or action was performed.</p> 362 * @return resource 363 */ 364 365 public com.commercetools.api.models.common.Reference getResource() { 366 return this.resource; 367 } 368 369 /** 370 * <p>Version of the resource on which the change or action was performed.</p> 371 * @return resourceVersion 372 */ 373 374 public Long getResourceVersion() { 375 return this.resourceVersion; 376 } 377 378 /** 379 * <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> 380 * @return resourceUserProvidedIdentifiers 381 */ 382 383 @Nullable 384 public com.commercetools.api.models.message.UserProvidedIdentifiers getResourceUserProvidedIdentifiers() { 385 return this.resourceUserProvidedIdentifiers; 386 } 387 388 /** 389 * <p>Store that was set.</p> 390 * @return store 391 */ 392 393 @Nullable 394 public com.commercetools.api.models.store.StoreKeyReference getStore() { 395 return this.store; 396 } 397 398 /** 399 * builds OrderStoreSetMessage with checking for non-null required values 400 * @return OrderStoreSetMessage 401 */ 402 public OrderStoreSetMessage build() { 403 Objects.requireNonNull(id, OrderStoreSetMessage.class + ": id is missing"); 404 Objects.requireNonNull(version, OrderStoreSetMessage.class + ": version is missing"); 405 Objects.requireNonNull(createdAt, OrderStoreSetMessage.class + ": createdAt is missing"); 406 Objects.requireNonNull(lastModifiedAt, OrderStoreSetMessage.class + ": lastModifiedAt is missing"); 407 Objects.requireNonNull(sequenceNumber, OrderStoreSetMessage.class + ": sequenceNumber is missing"); 408 Objects.requireNonNull(resource, OrderStoreSetMessage.class + ": resource is missing"); 409 Objects.requireNonNull(resourceVersion, OrderStoreSetMessage.class + ": resourceVersion is missing"); 410 return new OrderStoreSetMessageImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy, createdBy, 411 sequenceNumber, resource, resourceVersion, resourceUserProvidedIdentifiers, store); 412 } 413 414 /** 415 * builds OrderStoreSetMessage without checking for non-null required values 416 * @return OrderStoreSetMessage 417 */ 418 public OrderStoreSetMessage buildUnchecked() { 419 return new OrderStoreSetMessageImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy, createdBy, 420 sequenceNumber, resource, resourceVersion, resourceUserProvidedIdentifiers, store); 421 } 422 423 /** 424 * factory method for an instance of OrderStoreSetMessageBuilder 425 * @return builder 426 */ 427 public static OrderStoreSetMessageBuilder of() { 428 return new OrderStoreSetMessageBuilder(); 429 } 430 431 /** 432 * create builder for OrderStoreSetMessage instance 433 * @param template instance with prefilled values for the builder 434 * @return builder 435 */ 436 public static OrderStoreSetMessageBuilder of(final OrderStoreSetMessage template) { 437 OrderStoreSetMessageBuilder builder = new OrderStoreSetMessageBuilder(); 438 builder.id = template.getId(); 439 builder.version = template.getVersion(); 440 builder.createdAt = template.getCreatedAt(); 441 builder.lastModifiedAt = template.getLastModifiedAt(); 442 builder.lastModifiedBy = template.getLastModifiedBy(); 443 builder.createdBy = template.getCreatedBy(); 444 builder.sequenceNumber = template.getSequenceNumber(); 445 builder.resource = template.getResource(); 446 builder.resourceVersion = template.getResourceVersion(); 447 builder.resourceUserProvidedIdentifiers = template.getResourceUserProvidedIdentifiers(); 448 builder.store = template.getStore(); 449 return builder; 450 } 451 452}