001 002package com.commercetools.api.models.product; 003 004import java.util.*; 005 006import javax.annotation.Nullable; 007 008import io.vrap.rmf.base.client.Builder; 009import io.vrap.rmf.base.client.utils.Generated; 010 011/** 012 * ProductChangeAssetOrderActionBuilder 013 * <hr> 014 * Example to create an instance using the builder pattern 015 * <div class=code-example> 016 * <pre><code class='java'> 017 * ProductChangeAssetOrderAction productChangeAssetOrderAction = ProductChangeAssetOrderAction.builder() 018 * .plusAssetOrder(assetOrderBuilder -> assetOrderBuilder) 019 * .build() 020 * </code></pre> 021 * </div> 022 */ 023@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 024public class ProductChangeAssetOrderActionBuilder implements Builder<ProductChangeAssetOrderAction> { 025 026 @Nullable 027 private Long variantId; 028 029 @Nullable 030 private String sku; 031 032 @Nullable 033 private Boolean staged; 034 035 private java.util.List<String> assetOrder; 036 037 /** 038 * <p>The <code>id</code> of the ProductVariant to update.</p> 039 * @param variantId value to be set 040 * @return Builder 041 */ 042 043 public ProductChangeAssetOrderActionBuilder variantId(@Nullable final Long variantId) { 044 this.variantId = variantId; 045 return this; 046 } 047 048 /** 049 * <p>The <code>sku</code> of the ProductVariant to update.</p> 050 * @param sku value to be set 051 * @return Builder 052 */ 053 054 public ProductChangeAssetOrderActionBuilder sku(@Nullable final String sku) { 055 this.sku = sku; 056 return this; 057 } 058 059 /** 060 * <p>If <code>true</code>, only the staged <code>assets</code> is updated. If <code>false</code>, both the current and staged <code>assets</code> are updated.</p> 061 * @param staged value to be set 062 * @return Builder 063 */ 064 065 public ProductChangeAssetOrderActionBuilder staged(@Nullable final Boolean staged) { 066 this.staged = staged; 067 return this; 068 } 069 070 /** 071 * <p>All existing Asset <code>id</code>s of the ProductVariant in the desired new order.</p> 072 * @param assetOrder value to be set 073 * @return Builder 074 */ 075 076 public ProductChangeAssetOrderActionBuilder assetOrder(final String... assetOrder) { 077 this.assetOrder = new ArrayList<>(Arrays.asList(assetOrder)); 078 return this; 079 } 080 081 /** 082 * <p>All existing Asset <code>id</code>s of the ProductVariant in the desired new order.</p> 083 * @param assetOrder value to be set 084 * @return Builder 085 */ 086 087 public ProductChangeAssetOrderActionBuilder assetOrder(final java.util.List<String> assetOrder) { 088 this.assetOrder = assetOrder; 089 return this; 090 } 091 092 /** 093 * <p>All existing Asset <code>id</code>s of the ProductVariant in the desired new order.</p> 094 * @param assetOrder value to be set 095 * @return Builder 096 */ 097 098 public ProductChangeAssetOrderActionBuilder plusAssetOrder(final String... assetOrder) { 099 if (this.assetOrder == null) { 100 this.assetOrder = new ArrayList<>(); 101 } 102 this.assetOrder.addAll(Arrays.asList(assetOrder)); 103 return this; 104 } 105 106 /** 107 * <p>The <code>id</code> of the ProductVariant to update.</p> 108 * @return variantId 109 */ 110 111 @Nullable 112 public Long getVariantId() { 113 return this.variantId; 114 } 115 116 /** 117 * <p>The <code>sku</code> of the ProductVariant to update.</p> 118 * @return sku 119 */ 120 121 @Nullable 122 public String getSku() { 123 return this.sku; 124 } 125 126 /** 127 * <p>If <code>true</code>, only the staged <code>assets</code> is updated. If <code>false</code>, both the current and staged <code>assets</code> are updated.</p> 128 * @return staged 129 */ 130 131 @Nullable 132 public Boolean getStaged() { 133 return this.staged; 134 } 135 136 /** 137 * <p>All existing Asset <code>id</code>s of the ProductVariant in the desired new order.</p> 138 * @return assetOrder 139 */ 140 141 public java.util.List<String> getAssetOrder() { 142 return this.assetOrder; 143 } 144 145 /** 146 * builds ProductChangeAssetOrderAction with checking for non-null required values 147 * @return ProductChangeAssetOrderAction 148 */ 149 public ProductChangeAssetOrderAction build() { 150 Objects.requireNonNull(assetOrder, ProductChangeAssetOrderAction.class + ": assetOrder is missing"); 151 return new ProductChangeAssetOrderActionImpl(variantId, sku, staged, assetOrder); 152 } 153 154 /** 155 * builds ProductChangeAssetOrderAction without checking for non-null required values 156 * @return ProductChangeAssetOrderAction 157 */ 158 public ProductChangeAssetOrderAction buildUnchecked() { 159 return new ProductChangeAssetOrderActionImpl(variantId, sku, staged, assetOrder); 160 } 161 162 /** 163 * factory method for an instance of ProductChangeAssetOrderActionBuilder 164 * @return builder 165 */ 166 public static ProductChangeAssetOrderActionBuilder of() { 167 return new ProductChangeAssetOrderActionBuilder(); 168 } 169 170 /** 171 * create builder for ProductChangeAssetOrderAction instance 172 * @param template instance with prefilled values for the builder 173 * @return builder 174 */ 175 public static ProductChangeAssetOrderActionBuilder of(final ProductChangeAssetOrderAction template) { 176 ProductChangeAssetOrderActionBuilder builder = new ProductChangeAssetOrderActionBuilder(); 177 builder.variantId = template.getVariantId(); 178 builder.sku = template.getSku(); 179 builder.staged = template.getStaged(); 180 builder.assetOrder = template.getAssetOrder(); 181 return builder; 182 } 183 184}