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