001 002package com.commercetools.api.models.order_edit; 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 * StagedOrderAddCustomLineItemActionBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * StagedOrderAddCustomLineItemAction stagedOrderAddCustomLineItemAction = StagedOrderAddCustomLineItemAction.builder() 019 * .money(moneyBuilder -> moneyBuilder) 020 * .name(nameBuilder -> nameBuilder) 021 * .slug("{slug}") 022 * .build() 023 * </code></pre> 024 * </div> 025 */ 026@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 027public class StagedOrderAddCustomLineItemActionBuilder implements Builder<StagedOrderAddCustomLineItemAction> { 028 029 private com.commercetools.api.models.common.Money money; 030 031 private com.commercetools.api.models.common.LocalizedString name; 032 033 @Nullable 034 private Long quantity; 035 036 private String slug; 037 038 @Nullable 039 private com.commercetools.api.models.tax_category.TaxCategoryResourceIdentifier taxCategory; 040 041 @Nullable 042 private com.commercetools.api.models.type.CustomFieldsDraft custom; 043 044 @Nullable 045 private com.commercetools.api.models.cart.ExternalTaxRateDraft externalTaxRate; 046 047 @Nullable 048 private com.commercetools.api.models.cart.CustomLineItemPriceMode priceMode; 049 050 /** 051 * <p>Draft type that stores amounts only in cent precision for the specified currency.</p> 052 * @param builder function to build the money value 053 * @return Builder 054 */ 055 056 public StagedOrderAddCustomLineItemActionBuilder money( 057 Function<com.commercetools.api.models.common.MoneyBuilder, com.commercetools.api.models.common.MoneyBuilder> builder) { 058 this.money = builder.apply(com.commercetools.api.models.common.MoneyBuilder.of()).build(); 059 return this; 060 } 061 062 /** 063 * <p>Draft type that stores amounts only in cent precision for the specified currency.</p> 064 * @param builder function to build the money value 065 * @return Builder 066 */ 067 068 public StagedOrderAddCustomLineItemActionBuilder withMoney( 069 Function<com.commercetools.api.models.common.MoneyBuilder, com.commercetools.api.models.common.Money> builder) { 070 this.money = builder.apply(com.commercetools.api.models.common.MoneyBuilder.of()); 071 return this; 072 } 073 074 /** 075 * <p>Draft type that stores amounts only in cent precision for the specified currency.</p> 076 * @param money value to be set 077 * @return Builder 078 */ 079 080 public StagedOrderAddCustomLineItemActionBuilder money(final com.commercetools.api.models.common.Money money) { 081 this.money = money; 082 return this; 083 } 084 085 /** 086 * <p>JSON object where the keys are of type Locale, and the values are the strings used for the corresponding language.</p> 087 * @param builder function to build the name value 088 * @return Builder 089 */ 090 091 public StagedOrderAddCustomLineItemActionBuilder name( 092 Function<com.commercetools.api.models.common.LocalizedStringBuilder, com.commercetools.api.models.common.LocalizedStringBuilder> builder) { 093 this.name = builder.apply(com.commercetools.api.models.common.LocalizedStringBuilder.of()).build(); 094 return this; 095 } 096 097 /** 098 * <p>JSON object where the keys are of type Locale, and the values are the strings used for the corresponding language.</p> 099 * @param builder function to build the name value 100 * @return Builder 101 */ 102 103 public StagedOrderAddCustomLineItemActionBuilder withName( 104 Function<com.commercetools.api.models.common.LocalizedStringBuilder, com.commercetools.api.models.common.LocalizedString> builder) { 105 this.name = builder.apply(com.commercetools.api.models.common.LocalizedStringBuilder.of()); 106 return this; 107 } 108 109 /** 110 * <p>JSON object where the keys are of type Locale, and the values are the strings used for the corresponding language.</p> 111 * @param name value to be set 112 * @return Builder 113 */ 114 115 public StagedOrderAddCustomLineItemActionBuilder name( 116 final com.commercetools.api.models.common.LocalizedString name) { 117 this.name = name; 118 return this; 119 } 120 121 /** 122 * set the value to the quantity 123 * @param quantity value to be set 124 * @return Builder 125 */ 126 127 public StagedOrderAddCustomLineItemActionBuilder quantity(@Nullable final Long quantity) { 128 this.quantity = quantity; 129 return this; 130 } 131 132 /** 133 * set the value to the slug 134 * @param slug value to be set 135 * @return Builder 136 */ 137 138 public StagedOrderAddCustomLineItemActionBuilder slug(final String slug) { 139 this.slug = slug; 140 return this; 141 } 142 143 /** 144 * <p>ResourceIdentifier to a TaxCategory.</p> 145 * @param builder function to build the taxCategory value 146 * @return Builder 147 */ 148 149 public StagedOrderAddCustomLineItemActionBuilder taxCategory( 150 Function<com.commercetools.api.models.tax_category.TaxCategoryResourceIdentifierBuilder, com.commercetools.api.models.tax_category.TaxCategoryResourceIdentifierBuilder> builder) { 151 this.taxCategory = builder 152 .apply(com.commercetools.api.models.tax_category.TaxCategoryResourceIdentifierBuilder.of()) 153 .build(); 154 return this; 155 } 156 157 /** 158 * <p>ResourceIdentifier to a TaxCategory.</p> 159 * @param builder function to build the taxCategory value 160 * @return Builder 161 */ 162 163 public StagedOrderAddCustomLineItemActionBuilder withTaxCategory( 164 Function<com.commercetools.api.models.tax_category.TaxCategoryResourceIdentifierBuilder, com.commercetools.api.models.tax_category.TaxCategoryResourceIdentifier> builder) { 165 this.taxCategory = builder 166 .apply(com.commercetools.api.models.tax_category.TaxCategoryResourceIdentifierBuilder.of()); 167 return this; 168 } 169 170 /** 171 * <p>ResourceIdentifier to a TaxCategory.</p> 172 * @param taxCategory value to be set 173 * @return Builder 174 */ 175 176 public StagedOrderAddCustomLineItemActionBuilder taxCategory( 177 @Nullable final com.commercetools.api.models.tax_category.TaxCategoryResourceIdentifier taxCategory) { 178 this.taxCategory = taxCategory; 179 return this; 180 } 181 182 /** 183 * <p>The representation used when creating or updating a customizable data type with Custom Fields.</p> 184 * @param builder function to build the custom value 185 * @return Builder 186 */ 187 188 public StagedOrderAddCustomLineItemActionBuilder custom( 189 Function<com.commercetools.api.models.type.CustomFieldsDraftBuilder, com.commercetools.api.models.type.CustomFieldsDraftBuilder> builder) { 190 this.custom = builder.apply(com.commercetools.api.models.type.CustomFieldsDraftBuilder.of()).build(); 191 return this; 192 } 193 194 /** 195 * <p>The representation used when creating or updating a customizable data type with Custom Fields.</p> 196 * @param builder function to build the custom value 197 * @return Builder 198 */ 199 200 public StagedOrderAddCustomLineItemActionBuilder withCustom( 201 Function<com.commercetools.api.models.type.CustomFieldsDraftBuilder, com.commercetools.api.models.type.CustomFieldsDraft> builder) { 202 this.custom = builder.apply(com.commercetools.api.models.type.CustomFieldsDraftBuilder.of()); 203 return this; 204 } 205 206 /** 207 * <p>The representation used when creating or updating a customizable data type with Custom Fields.</p> 208 * @param custom value to be set 209 * @return Builder 210 */ 211 212 public StagedOrderAddCustomLineItemActionBuilder custom( 213 @Nullable final com.commercetools.api.models.type.CustomFieldsDraft custom) { 214 this.custom = custom; 215 return this; 216 } 217 218 /** 219 * <p>Controls calculation of taxed prices for Line Items, Custom Line Items, and Shipping Methods as explained in Cart tax calculation.</p> 220 * @param builder function to build the externalTaxRate value 221 * @return Builder 222 */ 223 224 public StagedOrderAddCustomLineItemActionBuilder externalTaxRate( 225 Function<com.commercetools.api.models.cart.ExternalTaxRateDraftBuilder, com.commercetools.api.models.cart.ExternalTaxRateDraftBuilder> builder) { 226 this.externalTaxRate = builder.apply(com.commercetools.api.models.cart.ExternalTaxRateDraftBuilder.of()) 227 .build(); 228 return this; 229 } 230 231 /** 232 * <p>Controls calculation of taxed prices for Line Items, Custom Line Items, and Shipping Methods as explained in Cart tax calculation.</p> 233 * @param builder function to build the externalTaxRate value 234 * @return Builder 235 */ 236 237 public StagedOrderAddCustomLineItemActionBuilder withExternalTaxRate( 238 Function<com.commercetools.api.models.cart.ExternalTaxRateDraftBuilder, com.commercetools.api.models.cart.ExternalTaxRateDraft> builder) { 239 this.externalTaxRate = builder.apply(com.commercetools.api.models.cart.ExternalTaxRateDraftBuilder.of()); 240 return this; 241 } 242 243 /** 244 * <p>Controls calculation of taxed prices for Line Items, Custom Line Items, and Shipping Methods as explained in Cart tax calculation.</p> 245 * @param externalTaxRate value to be set 246 * @return Builder 247 */ 248 249 public StagedOrderAddCustomLineItemActionBuilder externalTaxRate( 250 @Nullable final com.commercetools.api.models.cart.ExternalTaxRateDraft externalTaxRate) { 251 this.externalTaxRate = externalTaxRate; 252 return this; 253 } 254 255 /** 256 * <ul> 257 * <li>If <code>Standard</code>, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.</li> 258 * <li>If <code>External</code>, Cart Discounts are not considered on the Custom Line Item.</li> 259 * </ul> 260 * @param priceMode value to be set 261 * @return Builder 262 */ 263 264 public StagedOrderAddCustomLineItemActionBuilder priceMode( 265 @Nullable final com.commercetools.api.models.cart.CustomLineItemPriceMode priceMode) { 266 this.priceMode = priceMode; 267 return this; 268 } 269 270 /** 271 * <p>Draft type that stores amounts only in cent precision for the specified currency.</p> 272 * @return money 273 */ 274 275 public com.commercetools.api.models.common.Money getMoney() { 276 return this.money; 277 } 278 279 /** 280 * <p>JSON object where the keys are of type Locale, and the values are the strings used for the corresponding language.</p> 281 * @return name 282 */ 283 284 public com.commercetools.api.models.common.LocalizedString getName() { 285 return this.name; 286 } 287 288 /** 289 * value of quantity} 290 * @return quantity 291 */ 292 293 @Nullable 294 public Long getQuantity() { 295 return this.quantity; 296 } 297 298 /** 299 * value of slug} 300 * @return slug 301 */ 302 303 public String getSlug() { 304 return this.slug; 305 } 306 307 /** 308 * <p>ResourceIdentifier to a TaxCategory.</p> 309 * @return taxCategory 310 */ 311 312 @Nullable 313 public com.commercetools.api.models.tax_category.TaxCategoryResourceIdentifier getTaxCategory() { 314 return this.taxCategory; 315 } 316 317 /** 318 * <p>The representation used when creating or updating a customizable data type with Custom Fields.</p> 319 * @return custom 320 */ 321 322 @Nullable 323 public com.commercetools.api.models.type.CustomFieldsDraft getCustom() { 324 return this.custom; 325 } 326 327 /** 328 * <p>Controls calculation of taxed prices for Line Items, Custom Line Items, and Shipping Methods as explained in Cart tax calculation.</p> 329 * @return externalTaxRate 330 */ 331 332 @Nullable 333 public com.commercetools.api.models.cart.ExternalTaxRateDraft getExternalTaxRate() { 334 return this.externalTaxRate; 335 } 336 337 /** 338 * <ul> 339 * <li>If <code>Standard</code>, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.</li> 340 * <li>If <code>External</code>, Cart Discounts are not considered on the Custom Line Item.</li> 341 * </ul> 342 * @return priceMode 343 */ 344 345 @Nullable 346 public com.commercetools.api.models.cart.CustomLineItemPriceMode getPriceMode() { 347 return this.priceMode; 348 } 349 350 /** 351 * builds StagedOrderAddCustomLineItemAction with checking for non-null required values 352 * @return StagedOrderAddCustomLineItemAction 353 */ 354 public StagedOrderAddCustomLineItemAction build() { 355 Objects.requireNonNull(money, StagedOrderAddCustomLineItemAction.class + ": money is missing"); 356 Objects.requireNonNull(name, StagedOrderAddCustomLineItemAction.class + ": name is missing"); 357 Objects.requireNonNull(slug, StagedOrderAddCustomLineItemAction.class + ": slug is missing"); 358 return new StagedOrderAddCustomLineItemActionImpl(money, name, quantity, slug, taxCategory, custom, 359 externalTaxRate, priceMode); 360 } 361 362 /** 363 * builds StagedOrderAddCustomLineItemAction without checking for non-null required values 364 * @return StagedOrderAddCustomLineItemAction 365 */ 366 public StagedOrderAddCustomLineItemAction buildUnchecked() { 367 return new StagedOrderAddCustomLineItemActionImpl(money, name, quantity, slug, taxCategory, custom, 368 externalTaxRate, priceMode); 369 } 370 371 /** 372 * factory method for an instance of StagedOrderAddCustomLineItemActionBuilder 373 * @return builder 374 */ 375 public static StagedOrderAddCustomLineItemActionBuilder of() { 376 return new StagedOrderAddCustomLineItemActionBuilder(); 377 } 378 379 /** 380 * create builder for StagedOrderAddCustomLineItemAction instance 381 * @param template instance with prefilled values for the builder 382 * @return builder 383 */ 384 public static StagedOrderAddCustomLineItemActionBuilder of(final StagedOrderAddCustomLineItemAction template) { 385 StagedOrderAddCustomLineItemActionBuilder builder = new StagedOrderAddCustomLineItemActionBuilder(); 386 builder.money = template.getMoney(); 387 builder.name = template.getName(); 388 builder.quantity = template.getQuantity(); 389 builder.slug = template.getSlug(); 390 builder.taxCategory = template.getTaxCategory(); 391 builder.custom = template.getCustom(); 392 builder.externalTaxRate = template.getExternalTaxRate(); 393 builder.priceMode = template.getPriceMode(); 394 return builder; 395 } 396 397}