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 * SetOrderTaxedPriceChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * SetOrderTaxedPriceChange setOrderTaxedPriceChange = SetOrderTaxedPriceChange.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 SetOrderTaxedPriceChangeBuilder implements Builder<SetOrderTaxedPriceChange> { 027 028 private String change; 029 030 private com.commercetools.history.models.common.TaxedItemPrice previousValue; 031 032 private com.commercetools.history.models.common.TaxedItemPrice 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 SetOrderTaxedPriceChangeBuilder 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 SetOrderTaxedPriceChangeBuilder previousValue( 054 Function<com.commercetools.history.models.common.TaxedItemPriceBuilder, com.commercetools.history.models.common.TaxedItemPriceBuilder> builder) { 055 this.previousValue = builder.apply(com.commercetools.history.models.common.TaxedItemPriceBuilder.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 SetOrderTaxedPriceChangeBuilder withPreviousValue( 066 Function<com.commercetools.history.models.common.TaxedItemPriceBuilder, com.commercetools.history.models.common.TaxedItemPrice> builder) { 067 this.previousValue = builder.apply(com.commercetools.history.models.common.TaxedItemPriceBuilder.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 SetOrderTaxedPriceChangeBuilder previousValue( 078 final com.commercetools.history.models.common.TaxedItemPrice 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 SetOrderTaxedPriceChangeBuilder nextValue( 090 Function<com.commercetools.history.models.common.TaxedItemPriceBuilder, com.commercetools.history.models.common.TaxedItemPriceBuilder> builder) { 091 this.nextValue = builder.apply(com.commercetools.history.models.common.TaxedItemPriceBuilder.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 SetOrderTaxedPriceChangeBuilder withNextValue( 102 Function<com.commercetools.history.models.common.TaxedItemPriceBuilder, com.commercetools.history.models.common.TaxedItemPrice> builder) { 103 this.nextValue = builder.apply(com.commercetools.history.models.common.TaxedItemPriceBuilder.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 SetOrderTaxedPriceChangeBuilder nextValue( 114 final com.commercetools.history.models.common.TaxedItemPrice nextValue) { 115 this.nextValue = nextValue; 116 return this; 117 } 118 119 /** 120 * set the value to the taxMode 121 * @param taxMode value to be set 122 * @return Builder 123 */ 124 125 public SetOrderTaxedPriceChangeBuilder taxMode(final com.commercetools.history.models.common.TaxMode taxMode) { 126 this.taxMode = taxMode; 127 return this; 128 } 129 130 /** 131 * value of change} 132 * @return change 133 */ 134 135 public String getChange() { 136 return this.change; 137 } 138 139 /** 140 * <p>Value before the change.</p> 141 * @return previousValue 142 */ 143 144 public com.commercetools.history.models.common.TaxedItemPrice getPreviousValue() { 145 return this.previousValue; 146 } 147 148 /** 149 * <p>Value after the change.</p> 150 * @return nextValue 151 */ 152 153 public com.commercetools.history.models.common.TaxedItemPrice getNextValue() { 154 return this.nextValue; 155 } 156 157 /** 158 * value of taxMode} 159 * @return taxMode 160 */ 161 162 public com.commercetools.history.models.common.TaxMode getTaxMode() { 163 return this.taxMode; 164 } 165 166 /** 167 * builds SetOrderTaxedPriceChange with checking for non-null required values 168 * @return SetOrderTaxedPriceChange 169 */ 170 public SetOrderTaxedPriceChange build() { 171 Objects.requireNonNull(change, SetOrderTaxedPriceChange.class + ": change is missing"); 172 Objects.requireNonNull(previousValue, SetOrderTaxedPriceChange.class + ": previousValue is missing"); 173 Objects.requireNonNull(nextValue, SetOrderTaxedPriceChange.class + ": nextValue is missing"); 174 Objects.requireNonNull(taxMode, SetOrderTaxedPriceChange.class + ": taxMode is missing"); 175 return new SetOrderTaxedPriceChangeImpl(change, previousValue, nextValue, taxMode); 176 } 177 178 /** 179 * builds SetOrderTaxedPriceChange without checking for non-null required values 180 * @return SetOrderTaxedPriceChange 181 */ 182 public SetOrderTaxedPriceChange buildUnchecked() { 183 return new SetOrderTaxedPriceChangeImpl(change, previousValue, nextValue, taxMode); 184 } 185 186 /** 187 * factory method for an instance of SetOrderTaxedPriceChangeBuilder 188 * @return builder 189 */ 190 public static SetOrderTaxedPriceChangeBuilder of() { 191 return new SetOrderTaxedPriceChangeBuilder(); 192 } 193 194 /** 195 * create builder for SetOrderTaxedPriceChange instance 196 * @param template instance with prefilled values for the builder 197 * @return builder 198 */ 199 public static SetOrderTaxedPriceChangeBuilder of(final SetOrderTaxedPriceChange template) { 200 SetOrderTaxedPriceChangeBuilder builder = new SetOrderTaxedPriceChangeBuilder(); 201 builder.change = template.getChange(); 202 builder.previousValue = template.getPreviousValue(); 203 builder.nextValue = template.getNextValue(); 204 builder.taxMode = template.getTaxMode(); 205 return builder; 206 } 207 208}