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