001 002package com.commercetools.api.models.inventory; 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 * InventoryEntryBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * InventoryEntry inventoryEntry = InventoryEntry.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 * .sku("{sku}") 024 * .quantityOnStock(0.3) 025 * .availableQuantity(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 InventoryEntryBuilder implements Builder<InventoryEntry> { 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 @Nullable 048 private String key; 049 050 private String sku; 051 052 @Nullable 053 private com.commercetools.api.models.channel.ChannelReference supplyChannel; 054 055 private Long quantityOnStock; 056 057 private Long availableQuantity; 058 059 @Nullable 060 private Long restockableInDays; 061 062 @Nullable 063 private java.time.ZonedDateTime expectedDelivery; 064 065 @Nullable 066 private com.commercetools.api.models.type.CustomFields custom; 067 068 /** 069 * <p>Unique identifier of the InventoryEntry.</p> 070 * @param id value to be set 071 * @return Builder 072 */ 073 074 public InventoryEntryBuilder id(final String id) { 075 this.id = id; 076 return this; 077 } 078 079 /** 080 * <p>Current version of the InventoryEntry.</p> 081 * @param version value to be set 082 * @return Builder 083 */ 084 085 public InventoryEntryBuilder version(final Long version) { 086 this.version = version; 087 return this; 088 } 089 090 /** 091 * <p>Date and time (UTC) the InventoryEntry was initially created.</p> 092 * @param createdAt value to be set 093 * @return Builder 094 */ 095 096 public InventoryEntryBuilder createdAt(final java.time.ZonedDateTime createdAt) { 097 this.createdAt = createdAt; 098 return this; 099 } 100 101 /** 102 * <p>Date and time (UTC) the InventoryEntry was last updated.</p> 103 * @param lastModifiedAt value to be set 104 * @return Builder 105 */ 106 107 public InventoryEntryBuilder lastModifiedAt(final java.time.ZonedDateTime lastModifiedAt) { 108 this.lastModifiedAt = lastModifiedAt; 109 return this; 110 } 111 112 /** 113 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 114 * @param builder function to build the lastModifiedBy value 115 * @return Builder 116 */ 117 118 public InventoryEntryBuilder lastModifiedBy( 119 Function<com.commercetools.api.models.common.LastModifiedByBuilder, com.commercetools.api.models.common.LastModifiedByBuilder> builder) { 120 this.lastModifiedBy = builder.apply(com.commercetools.api.models.common.LastModifiedByBuilder.of()).build(); 121 return this; 122 } 123 124 /** 125 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 126 * @param builder function to build the lastModifiedBy value 127 * @return Builder 128 */ 129 130 public InventoryEntryBuilder withLastModifiedBy( 131 Function<com.commercetools.api.models.common.LastModifiedByBuilder, com.commercetools.api.models.common.LastModifiedBy> builder) { 132 this.lastModifiedBy = builder.apply(com.commercetools.api.models.common.LastModifiedByBuilder.of()); 133 return this; 134 } 135 136 /** 137 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 138 * @param lastModifiedBy value to be set 139 * @return Builder 140 */ 141 142 public InventoryEntryBuilder lastModifiedBy( 143 @Nullable final com.commercetools.api.models.common.LastModifiedBy lastModifiedBy) { 144 this.lastModifiedBy = lastModifiedBy; 145 return this; 146 } 147 148 /** 149 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 150 * @param builder function to build the createdBy value 151 * @return Builder 152 */ 153 154 public InventoryEntryBuilder createdBy( 155 Function<com.commercetools.api.models.common.CreatedByBuilder, com.commercetools.api.models.common.CreatedByBuilder> builder) { 156 this.createdBy = builder.apply(com.commercetools.api.models.common.CreatedByBuilder.of()).build(); 157 return this; 158 } 159 160 /** 161 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 162 * @param builder function to build the createdBy value 163 * @return Builder 164 */ 165 166 public InventoryEntryBuilder withCreatedBy( 167 Function<com.commercetools.api.models.common.CreatedByBuilder, com.commercetools.api.models.common.CreatedBy> builder) { 168 this.createdBy = builder.apply(com.commercetools.api.models.common.CreatedByBuilder.of()); 169 return this; 170 } 171 172 /** 173 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 174 * @param createdBy value to be set 175 * @return Builder 176 */ 177 178 public InventoryEntryBuilder createdBy(@Nullable final com.commercetools.api.models.common.CreatedBy createdBy) { 179 this.createdBy = createdBy; 180 return this; 181 } 182 183 /** 184 * <p>User-defined unique identifier of the InventoryEntry.</p> 185 * @param key value to be set 186 * @return Builder 187 */ 188 189 public InventoryEntryBuilder key(@Nullable final String key) { 190 this.key = key; 191 return this; 192 } 193 194 /** 195 * <p>ProductVariant <code>sku</code> of the InventoryEntry.</p> 196 * @param sku value to be set 197 * @return Builder 198 */ 199 200 public InventoryEntryBuilder sku(final String sku) { 201 this.sku = sku; 202 return this; 203 } 204 205 /** 206 * <p>Channel that supplies this InventoryEntry.</p> 207 * @param builder function to build the supplyChannel value 208 * @return Builder 209 */ 210 211 public InventoryEntryBuilder supplyChannel( 212 Function<com.commercetools.api.models.channel.ChannelReferenceBuilder, com.commercetools.api.models.channel.ChannelReferenceBuilder> builder) { 213 this.supplyChannel = builder.apply(com.commercetools.api.models.channel.ChannelReferenceBuilder.of()).build(); 214 return this; 215 } 216 217 /** 218 * <p>Channel that supplies this InventoryEntry.</p> 219 * @param builder function to build the supplyChannel value 220 * @return Builder 221 */ 222 223 public InventoryEntryBuilder withSupplyChannel( 224 Function<com.commercetools.api.models.channel.ChannelReferenceBuilder, com.commercetools.api.models.channel.ChannelReference> builder) { 225 this.supplyChannel = builder.apply(com.commercetools.api.models.channel.ChannelReferenceBuilder.of()); 226 return this; 227 } 228 229 /** 230 * <p>Channel that supplies this InventoryEntry.</p> 231 * @param supplyChannel value to be set 232 * @return Builder 233 */ 234 235 public InventoryEntryBuilder supplyChannel( 236 @Nullable final com.commercetools.api.models.channel.ChannelReference supplyChannel) { 237 this.supplyChannel = supplyChannel; 238 return this; 239 } 240 241 /** 242 * <p>Overall amount of stock (<code>availableQuantity</code> + reserved).</p> 243 * @param quantityOnStock value to be set 244 * @return Builder 245 */ 246 247 public InventoryEntryBuilder quantityOnStock(final Long quantityOnStock) { 248 this.quantityOnStock = quantityOnStock; 249 return this; 250 } 251 252 /** 253 * <p>Available amount of stock (<code>quantityOnStock</code> - reserved).</p> 254 * @param availableQuantity value to be set 255 * @return Builder 256 */ 257 258 public InventoryEntryBuilder availableQuantity(final Long availableQuantity) { 259 this.availableQuantity = availableQuantity; 260 return this; 261 } 262 263 /** 264 * <p>How often the InventoryEntry is restocked (in days).</p> 265 * @param restockableInDays value to be set 266 * @return Builder 267 */ 268 269 public InventoryEntryBuilder restockableInDays(@Nullable final Long restockableInDays) { 270 this.restockableInDays = restockableInDays; 271 return this; 272 } 273 274 /** 275 * <p>Date and time of the next restock.</p> 276 * @param expectedDelivery value to be set 277 * @return Builder 278 */ 279 280 public InventoryEntryBuilder expectedDelivery(@Nullable final java.time.ZonedDateTime expectedDelivery) { 281 this.expectedDelivery = expectedDelivery; 282 return this; 283 } 284 285 /** 286 * <p>Custom Fields of the InventoryEntry.</p> 287 * @param builder function to build the custom value 288 * @return Builder 289 */ 290 291 public InventoryEntryBuilder custom( 292 Function<com.commercetools.api.models.type.CustomFieldsBuilder, com.commercetools.api.models.type.CustomFieldsBuilder> builder) { 293 this.custom = builder.apply(com.commercetools.api.models.type.CustomFieldsBuilder.of()).build(); 294 return this; 295 } 296 297 /** 298 * <p>Custom Fields of the InventoryEntry.</p> 299 * @param builder function to build the custom value 300 * @return Builder 301 */ 302 303 public InventoryEntryBuilder withCustom( 304 Function<com.commercetools.api.models.type.CustomFieldsBuilder, com.commercetools.api.models.type.CustomFields> builder) { 305 this.custom = builder.apply(com.commercetools.api.models.type.CustomFieldsBuilder.of()); 306 return this; 307 } 308 309 /** 310 * <p>Custom Fields of the InventoryEntry.</p> 311 * @param custom value to be set 312 * @return Builder 313 */ 314 315 public InventoryEntryBuilder custom(@Nullable final com.commercetools.api.models.type.CustomFields custom) { 316 this.custom = custom; 317 return this; 318 } 319 320 /** 321 * <p>Unique identifier of the InventoryEntry.</p> 322 * @return id 323 */ 324 325 public String getId() { 326 return this.id; 327 } 328 329 /** 330 * <p>Current version of the InventoryEntry.</p> 331 * @return version 332 */ 333 334 public Long getVersion() { 335 return this.version; 336 } 337 338 /** 339 * <p>Date and time (UTC) the InventoryEntry was initially created.</p> 340 * @return createdAt 341 */ 342 343 public java.time.ZonedDateTime getCreatedAt() { 344 return this.createdAt; 345 } 346 347 /** 348 * <p>Date and time (UTC) the InventoryEntry was last updated.</p> 349 * @return lastModifiedAt 350 */ 351 352 public java.time.ZonedDateTime getLastModifiedAt() { 353 return this.lastModifiedAt; 354 } 355 356 /** 357 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 358 * @return lastModifiedBy 359 */ 360 361 @Nullable 362 public com.commercetools.api.models.common.LastModifiedBy getLastModifiedBy() { 363 return this.lastModifiedBy; 364 } 365 366 /** 367 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 368 * @return createdBy 369 */ 370 371 @Nullable 372 public com.commercetools.api.models.common.CreatedBy getCreatedBy() { 373 return this.createdBy; 374 } 375 376 /** 377 * <p>User-defined unique identifier of the InventoryEntry.</p> 378 * @return key 379 */ 380 381 @Nullable 382 public String getKey() { 383 return this.key; 384 } 385 386 /** 387 * <p>ProductVariant <code>sku</code> of the InventoryEntry.</p> 388 * @return sku 389 */ 390 391 public String getSku() { 392 return this.sku; 393 } 394 395 /** 396 * <p>Channel that supplies this InventoryEntry.</p> 397 * @return supplyChannel 398 */ 399 400 @Nullable 401 public com.commercetools.api.models.channel.ChannelReference getSupplyChannel() { 402 return this.supplyChannel; 403 } 404 405 /** 406 * <p>Overall amount of stock (<code>availableQuantity</code> + reserved).</p> 407 * @return quantityOnStock 408 */ 409 410 public Long getQuantityOnStock() { 411 return this.quantityOnStock; 412 } 413 414 /** 415 * <p>Available amount of stock (<code>quantityOnStock</code> - reserved).</p> 416 * @return availableQuantity 417 */ 418 419 public Long getAvailableQuantity() { 420 return this.availableQuantity; 421 } 422 423 /** 424 * <p>How often the InventoryEntry is restocked (in days).</p> 425 * @return restockableInDays 426 */ 427 428 @Nullable 429 public Long getRestockableInDays() { 430 return this.restockableInDays; 431 } 432 433 /** 434 * <p>Date and time of the next restock.</p> 435 * @return expectedDelivery 436 */ 437 438 @Nullable 439 public java.time.ZonedDateTime getExpectedDelivery() { 440 return this.expectedDelivery; 441 } 442 443 /** 444 * <p>Custom Fields of the InventoryEntry.</p> 445 * @return custom 446 */ 447 448 @Nullable 449 public com.commercetools.api.models.type.CustomFields getCustom() { 450 return this.custom; 451 } 452 453 /** 454 * builds InventoryEntry with checking for non-null required values 455 * @return InventoryEntry 456 */ 457 public InventoryEntry build() { 458 Objects.requireNonNull(id, InventoryEntry.class + ": id is missing"); 459 Objects.requireNonNull(version, InventoryEntry.class + ": version is missing"); 460 Objects.requireNonNull(createdAt, InventoryEntry.class + ": createdAt is missing"); 461 Objects.requireNonNull(lastModifiedAt, InventoryEntry.class + ": lastModifiedAt is missing"); 462 Objects.requireNonNull(sku, InventoryEntry.class + ": sku is missing"); 463 Objects.requireNonNull(quantityOnStock, InventoryEntry.class + ": quantityOnStock is missing"); 464 Objects.requireNonNull(availableQuantity, InventoryEntry.class + ": availableQuantity is missing"); 465 return new InventoryEntryImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy, createdBy, key, sku, 466 supplyChannel, quantityOnStock, availableQuantity, restockableInDays, expectedDelivery, custom); 467 } 468 469 /** 470 * builds InventoryEntry without checking for non-null required values 471 * @return InventoryEntry 472 */ 473 public InventoryEntry buildUnchecked() { 474 return new InventoryEntryImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy, createdBy, key, sku, 475 supplyChannel, quantityOnStock, availableQuantity, restockableInDays, expectedDelivery, custom); 476 } 477 478 /** 479 * factory method for an instance of InventoryEntryBuilder 480 * @return builder 481 */ 482 public static InventoryEntryBuilder of() { 483 return new InventoryEntryBuilder(); 484 } 485 486 /** 487 * create builder for InventoryEntry instance 488 * @param template instance with prefilled values for the builder 489 * @return builder 490 */ 491 public static InventoryEntryBuilder of(final InventoryEntry template) { 492 InventoryEntryBuilder builder = new InventoryEntryBuilder(); 493 builder.id = template.getId(); 494 builder.version = template.getVersion(); 495 builder.createdAt = template.getCreatedAt(); 496 builder.lastModifiedAt = template.getLastModifiedAt(); 497 builder.lastModifiedBy = template.getLastModifiedBy(); 498 builder.createdBy = template.getCreatedBy(); 499 builder.key = template.getKey(); 500 builder.sku = template.getSku(); 501 builder.supplyChannel = template.getSupplyChannel(); 502 builder.quantityOnStock = template.getQuantityOnStock(); 503 builder.availableQuantity = template.getAvailableQuantity(); 504 builder.restockableInDays = template.getRestockableInDays(); 505 builder.expectedDelivery = template.getExpectedDelivery(); 506 builder.custom = template.getCustom(); 507 return builder; 508 } 509 510}