001 002package com.commercetools.api.models.cart; 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 * CartSetCustomLineItemTaxAmountActionBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * CartSetCustomLineItemTaxAmountAction cartSetCustomLineItemTaxAmountAction = CartSetCustomLineItemTaxAmountAction.builder() 019 * .customLineItemId("{customLineItemId}") 020 * .build() 021 * </code></pre> 022 * </div> 023 */ 024@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 025public class CartSetCustomLineItemTaxAmountActionBuilder implements Builder<CartSetCustomLineItemTaxAmountAction> { 026 027 private String customLineItemId; 028 029 @Nullable 030 private com.commercetools.api.models.cart.ExternalTaxAmountDraft externalTaxAmount; 031 032 /** 033 * <p><code>id</code> of the CustomLineItem to update.</p> 034 * @param customLineItemId value to be set 035 * @return Builder 036 */ 037 038 public CartSetCustomLineItemTaxAmountActionBuilder customLineItemId(final String customLineItemId) { 039 this.customLineItemId = customLineItemId; 040 return this; 041 } 042 043 /** 044 * <p>Value to set. If empty, any existing value is removed.</p> 045 * @param builder function to build the externalTaxAmount value 046 * @return Builder 047 */ 048 049 public CartSetCustomLineItemTaxAmountActionBuilder externalTaxAmount( 050 Function<com.commercetools.api.models.cart.ExternalTaxAmountDraftBuilder, com.commercetools.api.models.cart.ExternalTaxAmountDraftBuilder> builder) { 051 this.externalTaxAmount = builder.apply(com.commercetools.api.models.cart.ExternalTaxAmountDraftBuilder.of()) 052 .build(); 053 return this; 054 } 055 056 /** 057 * <p>Value to set. If empty, any existing value is removed.</p> 058 * @param builder function to build the externalTaxAmount value 059 * @return Builder 060 */ 061 062 public CartSetCustomLineItemTaxAmountActionBuilder withExternalTaxAmount( 063 Function<com.commercetools.api.models.cart.ExternalTaxAmountDraftBuilder, com.commercetools.api.models.cart.ExternalTaxAmountDraft> builder) { 064 this.externalTaxAmount = builder.apply(com.commercetools.api.models.cart.ExternalTaxAmountDraftBuilder.of()); 065 return this; 066 } 067 068 /** 069 * <p>Value to set. If empty, any existing value is removed.</p> 070 * @param externalTaxAmount value to be set 071 * @return Builder 072 */ 073 074 public CartSetCustomLineItemTaxAmountActionBuilder externalTaxAmount( 075 @Nullable final com.commercetools.api.models.cart.ExternalTaxAmountDraft externalTaxAmount) { 076 this.externalTaxAmount = externalTaxAmount; 077 return this; 078 } 079 080 /** 081 * <p><code>id</code> of the CustomLineItem to update.</p> 082 * @return customLineItemId 083 */ 084 085 public String getCustomLineItemId() { 086 return this.customLineItemId; 087 } 088 089 /** 090 * <p>Value to set. If empty, any existing value is removed.</p> 091 * @return externalTaxAmount 092 */ 093 094 @Nullable 095 public com.commercetools.api.models.cart.ExternalTaxAmountDraft getExternalTaxAmount() { 096 return this.externalTaxAmount; 097 } 098 099 /** 100 * builds CartSetCustomLineItemTaxAmountAction with checking for non-null required values 101 * @return CartSetCustomLineItemTaxAmountAction 102 */ 103 public CartSetCustomLineItemTaxAmountAction build() { 104 Objects.requireNonNull(customLineItemId, 105 CartSetCustomLineItemTaxAmountAction.class + ": customLineItemId is missing"); 106 return new CartSetCustomLineItemTaxAmountActionImpl(customLineItemId, externalTaxAmount); 107 } 108 109 /** 110 * builds CartSetCustomLineItemTaxAmountAction without checking for non-null required values 111 * @return CartSetCustomLineItemTaxAmountAction 112 */ 113 public CartSetCustomLineItemTaxAmountAction buildUnchecked() { 114 return new CartSetCustomLineItemTaxAmountActionImpl(customLineItemId, externalTaxAmount); 115 } 116 117 /** 118 * factory method for an instance of CartSetCustomLineItemTaxAmountActionBuilder 119 * @return builder 120 */ 121 public static CartSetCustomLineItemTaxAmountActionBuilder of() { 122 return new CartSetCustomLineItemTaxAmountActionBuilder(); 123 } 124 125 /** 126 * create builder for CartSetCustomLineItemTaxAmountAction instance 127 * @param template instance with prefilled values for the builder 128 * @return builder 129 */ 130 public static CartSetCustomLineItemTaxAmountActionBuilder of(final CartSetCustomLineItemTaxAmountAction template) { 131 CartSetCustomLineItemTaxAmountActionBuilder builder = new CartSetCustomLineItemTaxAmountActionBuilder(); 132 builder.customLineItemId = template.getCustomLineItemId(); 133 builder.externalTaxAmount = template.getExternalTaxAmount(); 134 return builder; 135 } 136 137}