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 * SetShippingMethodTaxRateChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * SetShippingMethodTaxRateChange setShippingMethodTaxRateChange = SetShippingMethodTaxRateChange.builder() 017 * .change("{change}") 018 * .previousValue(previousValueBuilder -> previousValueBuilder) 019 * .nextValue(nextValueBuilder -> nextValueBuilder) 020 * .taxMode(TaxMode.PLATFORM) 021 * .build() 022 * </code></pre> 023 * </div> 024 */ 025@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 026public class SetShippingMethodTaxRateChangeBuilder implements Builder<SetShippingMethodTaxRateChange> { 027 028 private String change; 029 030 private com.commercetools.history.models.common.TaxRate previousValue; 031 032 private com.commercetools.history.models.common.TaxRate nextValue; 033 034 private com.commercetools.history.models.common.TaxMode taxMode; 035 036 /** 037 * set the value to the change 038 * @param change value to be set 039 * @return Builder 040 */ 041 042 public SetShippingMethodTaxRateChangeBuilder change(final String change) { 043 this.change = change; 044 return this; 045 } 046 047 /** 048 * <p>Value before the change.</p> 049 * @param builder function to build the previousValue value 050 * @return Builder 051 */ 052 053 public SetShippingMethodTaxRateChangeBuilder previousValue( 054 Function<com.commercetools.history.models.common.TaxRateBuilder, com.commercetools.history.models.common.TaxRateBuilder> builder) { 055 this.previousValue = builder.apply(com.commercetools.history.models.common.TaxRateBuilder.of()).build(); 056 return this; 057 } 058 059 /** 060 * <p>Value before the change.</p> 061 * @param builder function to build the previousValue value 062 * @return Builder 063 */ 064 065 public SetShippingMethodTaxRateChangeBuilder withPreviousValue( 066 Function<com.commercetools.history.models.common.TaxRateBuilder, com.commercetools.history.models.common.TaxRate> builder) { 067 this.previousValue = builder.apply(com.commercetools.history.models.common.TaxRateBuilder.of()); 068 return this; 069 } 070 071 /** 072 * <p>Value before the change.</p> 073 * @param previousValue value to be set 074 * @return Builder 075 */ 076 077 public SetShippingMethodTaxRateChangeBuilder previousValue( 078 final com.commercetools.history.models.common.TaxRate previousValue) { 079 this.previousValue = previousValue; 080 return this; 081 } 082 083 /** 084 * <p>Value after the change.</p> 085 * @param builder function to build the nextValue value 086 * @return Builder 087 */ 088 089 public SetShippingMethodTaxRateChangeBuilder nextValue( 090 Function<com.commercetools.history.models.common.TaxRateBuilder, com.commercetools.history.models.common.TaxRateBuilder> builder) { 091 this.nextValue = builder.apply(com.commercetools.history.models.common.TaxRateBuilder.of()).build(); 092 return this; 093 } 094 095 /** 096 * <p>Value after the change.</p> 097 * @param builder function to build the nextValue value 098 * @return Builder 099 */ 100 101 public SetShippingMethodTaxRateChangeBuilder withNextValue( 102 Function<com.commercetools.history.models.common.TaxRateBuilder, com.commercetools.history.models.common.TaxRate> builder) { 103 this.nextValue = builder.apply(com.commercetools.history.models.common.TaxRateBuilder.of()); 104 return this; 105 } 106 107 /** 108 * <p>Value after the change.</p> 109 * @param nextValue value to be set 110 * @return Builder 111 */ 112 113 public SetShippingMethodTaxRateChangeBuilder nextValue( 114 final com.commercetools.history.models.common.TaxRate nextValue) { 115 this.nextValue = nextValue; 116 return this; 117 } 118 119 /** 120 * <p><code>"External"</code></p> 121 * @param taxMode value to be set 122 * @return Builder 123 */ 124 125 public SetShippingMethodTaxRateChangeBuilder taxMode( 126 final com.commercetools.history.models.common.TaxMode taxMode) { 127 this.taxMode = taxMode; 128 return this; 129 } 130 131 /** 132 * value of change} 133 * @return change 134 */ 135 136 public String getChange() { 137 return this.change; 138 } 139 140 /** 141 * <p>Value before the change.</p> 142 * @return previousValue 143 */ 144 145 public com.commercetools.history.models.common.TaxRate getPreviousValue() { 146 return this.previousValue; 147 } 148 149 /** 150 * <p>Value after the change.</p> 151 * @return nextValue 152 */ 153 154 public com.commercetools.history.models.common.TaxRate getNextValue() { 155 return this.nextValue; 156 } 157 158 /** 159 * <p><code>"External"</code></p> 160 * @return taxMode 161 */ 162 163 public com.commercetools.history.models.common.TaxMode getTaxMode() { 164 return this.taxMode; 165 } 166 167 /** 168 * builds SetShippingMethodTaxRateChange with checking for non-null required values 169 * @return SetShippingMethodTaxRateChange 170 */ 171 public SetShippingMethodTaxRateChange build() { 172 Objects.requireNonNull(change, SetShippingMethodTaxRateChange.class + ": change is missing"); 173 Objects.requireNonNull(previousValue, SetShippingMethodTaxRateChange.class + ": previousValue is missing"); 174 Objects.requireNonNull(nextValue, SetShippingMethodTaxRateChange.class + ": nextValue is missing"); 175 Objects.requireNonNull(taxMode, SetShippingMethodTaxRateChange.class + ": taxMode is missing"); 176 return new SetShippingMethodTaxRateChangeImpl(change, previousValue, nextValue, taxMode); 177 } 178 179 /** 180 * builds SetShippingMethodTaxRateChange without checking for non-null required values 181 * @return SetShippingMethodTaxRateChange 182 */ 183 public SetShippingMethodTaxRateChange buildUnchecked() { 184 return new SetShippingMethodTaxRateChangeImpl(change, previousValue, nextValue, taxMode); 185 } 186 187 /** 188 * factory method for an instance of SetShippingMethodTaxRateChangeBuilder 189 * @return builder 190 */ 191 public static SetShippingMethodTaxRateChangeBuilder of() { 192 return new SetShippingMethodTaxRateChangeBuilder(); 193 } 194 195 /** 196 * create builder for SetShippingMethodTaxRateChange instance 197 * @param template instance with prefilled values for the builder 198 * @return builder 199 */ 200 public static SetShippingMethodTaxRateChangeBuilder of(final SetShippingMethodTaxRateChange template) { 201 SetShippingMethodTaxRateChangeBuilder builder = new SetShippingMethodTaxRateChangeBuilder(); 202 builder.change = template.getChange(); 203 builder.previousValue = template.getPreviousValue(); 204 builder.nextValue = template.getNextValue(); 205 builder.taxMode = template.getTaxMode(); 206 return builder; 207 } 208 209}