001
002package com.commercetools.history.models.change_value;
003
004import java.util.*;
005
006import io.vrap.rmf.base.client.Builder;
007import io.vrap.rmf.base.client.utils.Generated;
008
009/**
010 * InventoryQuantityValueBuilder
011 * <hr>
012 * Example to create an instance using the builder pattern
013 * <div class=code-example>
014 * <pre><code class='java'>
015 *     InventoryQuantityValue inventoryQuantityValue = InventoryQuantityValue.builder()
016 *             .quantityOnStock(1)
017 *             .availableQuantity(1)
018 *             .build()
019 * </code></pre>
020 * </div>
021 */
022@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
023public class InventoryQuantityValueBuilder implements Builder<InventoryQuantityValue> {
024
025    private Integer quantityOnStock;
026
027    private Integer availableQuantity;
028
029    /**
030     *  <p>Overall amount of stock (<code>availableQuantity</code> + reserved).</p>
031     * @param quantityOnStock value to be set
032     * @return Builder
033     */
034
035    public InventoryQuantityValueBuilder quantityOnStock(final Integer quantityOnStock) {
036        this.quantityOnStock = quantityOnStock;
037        return this;
038    }
039
040    /**
041     *  <p>Available amount of stock (<code>quantityOnStock</code> - reserved).</p>
042     * @param availableQuantity value to be set
043     * @return Builder
044     */
045
046    public InventoryQuantityValueBuilder availableQuantity(final Integer availableQuantity) {
047        this.availableQuantity = availableQuantity;
048        return this;
049    }
050
051    /**
052     *  <p>Overall amount of stock (<code>availableQuantity</code> + reserved).</p>
053     * @return quantityOnStock
054     */
055
056    public Integer getQuantityOnStock() {
057        return this.quantityOnStock;
058    }
059
060    /**
061     *  <p>Available amount of stock (<code>quantityOnStock</code> - reserved).</p>
062     * @return availableQuantity
063     */
064
065    public Integer getAvailableQuantity() {
066        return this.availableQuantity;
067    }
068
069    /**
070     * builds InventoryQuantityValue with checking for non-null required values
071     * @return InventoryQuantityValue
072     */
073    public InventoryQuantityValue build() {
074        Objects.requireNonNull(quantityOnStock, InventoryQuantityValue.class + ": quantityOnStock is missing");
075        Objects.requireNonNull(availableQuantity, InventoryQuantityValue.class + ": availableQuantity is missing");
076        return new InventoryQuantityValueImpl(quantityOnStock, availableQuantity);
077    }
078
079    /**
080     * builds InventoryQuantityValue without checking for non-null required values
081     * @return InventoryQuantityValue
082     */
083    public InventoryQuantityValue buildUnchecked() {
084        return new InventoryQuantityValueImpl(quantityOnStock, availableQuantity);
085    }
086
087    /**
088     * factory method for an instance of InventoryQuantityValueBuilder
089     * @return builder
090     */
091    public static InventoryQuantityValueBuilder of() {
092        return new InventoryQuantityValueBuilder();
093    }
094
095    /**
096     * create builder for InventoryQuantityValue instance
097     * @param template instance with prefilled values for the builder
098     * @return builder
099     */
100    public static InventoryQuantityValueBuilder of(final InventoryQuantityValue template) {
101        InventoryQuantityValueBuilder builder = new InventoryQuantityValueBuilder();
102        builder.quantityOnStock = template.getQuantityOnStock();
103        builder.availableQuantity = template.getAvailableQuantity();
104        return builder;
105    }
106
107}