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 * SetLineItemTaxRateChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * SetLineItemTaxRateChange setLineItemTaxRateChange = SetLineItemTaxRateChange.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 SetLineItemTaxRateChangeBuilder implements Builder<SetLineItemTaxRateChange> { 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 SetLineItemTaxRateChangeBuilder 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 SetLineItemTaxRateChangeBuilder 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 SetLineItemTaxRateChangeBuilder 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 SetLineItemTaxRateChangeBuilder 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 SetLineItemTaxRateChangeBuilder 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 SetLineItemTaxRateChangeBuilder 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 SetLineItemTaxRateChangeBuilder nextValue(final com.commercetools.history.models.common.TaxRate nextValue) { 120 this.nextValue = nextValue; 121 return this; 122 } 123 124 /** 125 * <p>Name of the Product the Line Item is based on.</p> 126 * @param builder function to build the lineItem value 127 * @return Builder 128 */ 129 130 public SetLineItemTaxRateChangeBuilder lineItem( 131 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedStringBuilder> builder) { 132 this.lineItem = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()).build(); 133 return this; 134 } 135 136 /** 137 * <p>Name of the Product the Line Item is based on.</p> 138 * @param builder function to build the lineItem value 139 * @return Builder 140 */ 141 142 public SetLineItemTaxRateChangeBuilder withLineItem( 143 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedString> builder) { 144 this.lineItem = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()); 145 return this; 146 } 147 148 /** 149 * <p>Name of the Product the Line Item is based on.</p> 150 * @param lineItem value to be set 151 * @return Builder 152 */ 153 154 public SetLineItemTaxRateChangeBuilder lineItem( 155 final com.commercetools.history.models.common.LocalizedString lineItem) { 156 this.lineItem = lineItem; 157 return this; 158 } 159 160 /** 161 * <p><code>sku</code> or <code>key</code> of the ProductVariant.</p> 162 * @param variant value to be set 163 * @return Builder 164 */ 165 166 public SetLineItemTaxRateChangeBuilder variant(final String variant) { 167 this.variant = variant; 168 return this; 169 } 170 171 /** 172 * <p><code>"External"</code></p> 173 * @param taxMode value to be set 174 * @return Builder 175 */ 176 177 public SetLineItemTaxRateChangeBuilder taxMode(final com.commercetools.history.models.common.TaxMode taxMode) { 178 this.taxMode = taxMode; 179 return this; 180 } 181 182 /** 183 * value of change} 184 * @return change 185 */ 186 187 public String getChange() { 188 return this.change; 189 } 190 191 /** 192 * <p>Value before the change.</p> 193 * @return previousValue 194 */ 195 196 public com.commercetools.history.models.common.TaxRate getPreviousValue() { 197 return this.previousValue; 198 } 199 200 /** 201 * <p>Value after the change.</p> 202 * @return nextValue 203 */ 204 205 public com.commercetools.history.models.common.TaxRate getNextValue() { 206 return this.nextValue; 207 } 208 209 /** 210 * <p>Name of the Product the Line Item is based on.</p> 211 * @return lineItem 212 */ 213 214 public com.commercetools.history.models.common.LocalizedString getLineItem() { 215 return this.lineItem; 216 } 217 218 /** 219 * <p><code>sku</code> or <code>key</code> of the ProductVariant.</p> 220 * @return variant 221 */ 222 223 public String getVariant() { 224 return this.variant; 225 } 226 227 /** 228 * <p><code>"External"</code></p> 229 * @return taxMode 230 */ 231 232 public com.commercetools.history.models.common.TaxMode getTaxMode() { 233 return this.taxMode; 234 } 235 236 /** 237 * builds SetLineItemTaxRateChange with checking for non-null required values 238 * @return SetLineItemTaxRateChange 239 */ 240 public SetLineItemTaxRateChange build() { 241 Objects.requireNonNull(change, SetLineItemTaxRateChange.class + ": change is missing"); 242 Objects.requireNonNull(previousValue, SetLineItemTaxRateChange.class + ": previousValue is missing"); 243 Objects.requireNonNull(nextValue, SetLineItemTaxRateChange.class + ": nextValue is missing"); 244 Objects.requireNonNull(lineItem, SetLineItemTaxRateChange.class + ": lineItem is missing"); 245 Objects.requireNonNull(variant, SetLineItemTaxRateChange.class + ": variant is missing"); 246 Objects.requireNonNull(taxMode, SetLineItemTaxRateChange.class + ": taxMode is missing"); 247 return new SetLineItemTaxRateChangeImpl(change, previousValue, nextValue, lineItem, variant, taxMode); 248 } 249 250 /** 251 * builds SetLineItemTaxRateChange without checking for non-null required values 252 * @return SetLineItemTaxRateChange 253 */ 254 public SetLineItemTaxRateChange buildUnchecked() { 255 return new SetLineItemTaxRateChangeImpl(change, previousValue, nextValue, lineItem, variant, taxMode); 256 } 257 258 /** 259 * factory method for an instance of SetLineItemTaxRateChangeBuilder 260 * @return builder 261 */ 262 public static SetLineItemTaxRateChangeBuilder of() { 263 return new SetLineItemTaxRateChangeBuilder(); 264 } 265 266 /** 267 * create builder for SetLineItemTaxRateChange instance 268 * @param template instance with prefilled values for the builder 269 * @return builder 270 */ 271 public static SetLineItemTaxRateChangeBuilder of(final SetLineItemTaxRateChange template) { 272 SetLineItemTaxRateChangeBuilder builder = new SetLineItemTaxRateChangeBuilder(); 273 builder.change = template.getChange(); 274 builder.previousValue = template.getPreviousValue(); 275 builder.nextValue = template.getNextValue(); 276 builder.lineItem = template.getLineItem(); 277 builder.variant = template.getVariant(); 278 builder.taxMode = template.getTaxMode(); 279 return builder; 280 } 281 282}