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