001 002package com.commercetools.history.models.change; 003 004import java.util.*; 005import java.util.function.Function; 006 007import io.vrap.rmf.base.client.Builder; 008import io.vrap.rmf.base.client.utils.Generated; 009 010/** 011 * SetLineItemTaxAmountChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * SetLineItemTaxAmountChange setLineItemTaxAmountChange = SetLineItemTaxAmountChange.builder() 017 * .change("{change}") 018 * .previousValue(previousValueBuilder -> previousValueBuilder) 019 * .nextValue(nextValueBuilder -> nextValueBuilder) 020 * .lineItem(lineItemBuilder -> lineItemBuilder) 021 * .variant("{variant}") 022 * .taxMode(TaxMode.PLATFORM) 023 * .build() 024 * </code></pre> 025 * </div> 026 */ 027@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 028public class SetLineItemTaxAmountChangeBuilder implements Builder<SetLineItemTaxAmountChange> { 029 030 private String change; 031 032 private com.commercetools.history.models.common.TaxRate previousValue; 033 034 private com.commercetools.history.models.common.TaxRate nextValue; 035 036 private com.commercetools.history.models.common.LocalizedString lineItem; 037 038 private String variant; 039 040 private com.commercetools.history.models.common.TaxMode taxMode; 041 042 /** 043 * set the value to the change 044 * @param change value to be set 045 * @return Builder 046 */ 047 048 public SetLineItemTaxAmountChangeBuilder change(final String change) { 049 this.change = change; 050 return this; 051 } 052 053 /** 054 * <p>Value before the change.</p> 055 * @param builder function to build the previousValue value 056 * @return Builder 057 */ 058 059 public SetLineItemTaxAmountChangeBuilder previousValue( 060 Function<com.commercetools.history.models.common.TaxRateBuilder, com.commercetools.history.models.common.TaxRateBuilder> builder) { 061 this.previousValue = builder.apply(com.commercetools.history.models.common.TaxRateBuilder.of()).build(); 062 return this; 063 } 064 065 /** 066 * <p>Value before the change.</p> 067 * @param builder function to build the previousValue value 068 * @return Builder 069 */ 070 071 public SetLineItemTaxAmountChangeBuilder withPreviousValue( 072 Function<com.commercetools.history.models.common.TaxRateBuilder, com.commercetools.history.models.common.TaxRate> builder) { 073 this.previousValue = builder.apply(com.commercetools.history.models.common.TaxRateBuilder.of()); 074 return this; 075 } 076 077 /** 078 * <p>Value before the change.</p> 079 * @param previousValue value to be set 080 * @return Builder 081 */ 082 083 public SetLineItemTaxAmountChangeBuilder previousValue( 084 final com.commercetools.history.models.common.TaxRate previousValue) { 085 this.previousValue = previousValue; 086 return this; 087 } 088 089 /** 090 * <p>Value after the change.</p> 091 * @param builder function to build the nextValue value 092 * @return Builder 093 */ 094 095 public SetLineItemTaxAmountChangeBuilder nextValue( 096 Function<com.commercetools.history.models.common.TaxRateBuilder, com.commercetools.history.models.common.TaxRateBuilder> builder) { 097 this.nextValue = builder.apply(com.commercetools.history.models.common.TaxRateBuilder.of()).build(); 098 return this; 099 } 100 101 /** 102 * <p>Value after the change.</p> 103 * @param builder function to build the nextValue value 104 * @return Builder 105 */ 106 107 public SetLineItemTaxAmountChangeBuilder withNextValue( 108 Function<com.commercetools.history.models.common.TaxRateBuilder, com.commercetools.history.models.common.TaxRate> builder) { 109 this.nextValue = builder.apply(com.commercetools.history.models.common.TaxRateBuilder.of()); 110 return this; 111 } 112 113 /** 114 * <p>Value after the change.</p> 115 * @param nextValue value to be set 116 * @return Builder 117 */ 118 119 public SetLineItemTaxAmountChangeBuilder nextValue( 120 final com.commercetools.history.models.common.TaxRate nextValue) { 121 this.nextValue = nextValue; 122 return this; 123 } 124 125 /** 126 * <p>Name of the Product the Line Item is based on.</p> 127 * @param builder function to build the lineItem value 128 * @return Builder 129 */ 130 131 public SetLineItemTaxAmountChangeBuilder lineItem( 132 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedStringBuilder> builder) { 133 this.lineItem = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()).build(); 134 return this; 135 } 136 137 /** 138 * <p>Name of the Product the Line Item is based on.</p> 139 * @param builder function to build the lineItem value 140 * @return Builder 141 */ 142 143 public SetLineItemTaxAmountChangeBuilder withLineItem( 144 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedString> builder) { 145 this.lineItem = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()); 146 return this; 147 } 148 149 /** 150 * <p>Name of the Product the Line Item is based on.</p> 151 * @param lineItem value to be set 152 * @return Builder 153 */ 154 155 public SetLineItemTaxAmountChangeBuilder lineItem( 156 final com.commercetools.history.models.common.LocalizedString lineItem) { 157 this.lineItem = lineItem; 158 return this; 159 } 160 161 /** 162 * <p><code>sku</code> or <code>key</code> of the ProductVariant.</p> 163 * @param variant value to be set 164 * @return Builder 165 */ 166 167 public SetLineItemTaxAmountChangeBuilder variant(final String variant) { 168 this.variant = variant; 169 return this; 170 } 171 172 /** 173 * <p><code>"ExternalAmount"</code></p> 174 * @param taxMode value to be set 175 * @return Builder 176 */ 177 178 public SetLineItemTaxAmountChangeBuilder taxMode(final com.commercetools.history.models.common.TaxMode taxMode) { 179 this.taxMode = taxMode; 180 return this; 181 } 182 183 /** 184 * value of change} 185 * @return change 186 */ 187 188 public String getChange() { 189 return this.change; 190 } 191 192 /** 193 * <p>Value before the change.</p> 194 * @return previousValue 195 */ 196 197 public com.commercetools.history.models.common.TaxRate getPreviousValue() { 198 return this.previousValue; 199 } 200 201 /** 202 * <p>Value after the change.</p> 203 * @return nextValue 204 */ 205 206 public com.commercetools.history.models.common.TaxRate getNextValue() { 207 return this.nextValue; 208 } 209 210 /** 211 * <p>Name of the Product the Line Item is based on.</p> 212 * @return lineItem 213 */ 214 215 public com.commercetools.history.models.common.LocalizedString getLineItem() { 216 return this.lineItem; 217 } 218 219 /** 220 * <p><code>sku</code> or <code>key</code> of the ProductVariant.</p> 221 * @return variant 222 */ 223 224 public String getVariant() { 225 return this.variant; 226 } 227 228 /** 229 * <p><code>"ExternalAmount"</code></p> 230 * @return taxMode 231 */ 232 233 public com.commercetools.history.models.common.TaxMode getTaxMode() { 234 return this.taxMode; 235 } 236 237 /** 238 * builds SetLineItemTaxAmountChange with checking for non-null required values 239 * @return SetLineItemTaxAmountChange 240 */ 241 public SetLineItemTaxAmountChange build() { 242 Objects.requireNonNull(change, SetLineItemTaxAmountChange.class + ": change is missing"); 243 Objects.requireNonNull(previousValue, SetLineItemTaxAmountChange.class + ": previousValue is missing"); 244 Objects.requireNonNull(nextValue, SetLineItemTaxAmountChange.class + ": nextValue is missing"); 245 Objects.requireNonNull(lineItem, SetLineItemTaxAmountChange.class + ": lineItem is missing"); 246 Objects.requireNonNull(variant, SetLineItemTaxAmountChange.class + ": variant is missing"); 247 Objects.requireNonNull(taxMode, SetLineItemTaxAmountChange.class + ": taxMode is missing"); 248 return new SetLineItemTaxAmountChangeImpl(change, previousValue, nextValue, lineItem, variant, taxMode); 249 } 250 251 /** 252 * builds SetLineItemTaxAmountChange without checking for non-null required values 253 * @return SetLineItemTaxAmountChange 254 */ 255 public SetLineItemTaxAmountChange buildUnchecked() { 256 return new SetLineItemTaxAmountChangeImpl(change, previousValue, nextValue, lineItem, variant, taxMode); 257 } 258 259 /** 260 * factory method for an instance of SetLineItemTaxAmountChangeBuilder 261 * @return builder 262 */ 263 public static SetLineItemTaxAmountChangeBuilder of() { 264 return new SetLineItemTaxAmountChangeBuilder(); 265 } 266 267 /** 268 * create builder for SetLineItemTaxAmountChange instance 269 * @param template instance with prefilled values for the builder 270 * @return builder 271 */ 272 public static SetLineItemTaxAmountChangeBuilder of(final SetLineItemTaxAmountChange template) { 273 SetLineItemTaxAmountChangeBuilder builder = new SetLineItemTaxAmountChangeBuilder(); 274 builder.change = template.getChange(); 275 builder.previousValue = template.getPreviousValue(); 276 builder.nextValue = template.getNextValue(); 277 builder.lineItem = template.getLineItem(); 278 builder.variant = template.getVariant(); 279 builder.taxMode = template.getTaxMode(); 280 return builder; 281 } 282 283}