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