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 * SetLineItemProductSlugChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * SetLineItemProductSlugChange setLineItemProductSlugChange = SetLineItemProductSlugChange.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 SetLineItemProductSlugChangeBuilder implements Builder<SetLineItemProductSlugChange> { 028 029 private String change; 030 031 private com.commercetools.history.models.common.LocalizedString previousValue; 032 033 private com.commercetools.history.models.common.LocalizedString nextValue; 034 035 private com.commercetools.history.models.common.LocalizedString lineItem; 036 037 private String variant; 038 039 /** 040 * set the value to the change 041 * @param change value to be set 042 * @return Builder 043 */ 044 045 public SetLineItemProductSlugChangeBuilder 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 SetLineItemProductSlugChangeBuilder previousValue( 057 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedStringBuilder> builder) { 058 this.previousValue = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.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 SetLineItemProductSlugChangeBuilder withPreviousValue( 069 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedString> builder) { 070 this.previousValue = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.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 SetLineItemProductSlugChangeBuilder previousValue( 081 final com.commercetools.history.models.common.LocalizedString 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 SetLineItemProductSlugChangeBuilder nextValue( 093 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedStringBuilder> builder) { 094 this.nextValue = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.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 SetLineItemProductSlugChangeBuilder withNextValue( 105 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedString> builder) { 106 this.nextValue = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.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 SetLineItemProductSlugChangeBuilder nextValue( 117 final com.commercetools.history.models.common.LocalizedString nextValue) { 118 this.nextValue = nextValue; 119 return this; 120 } 121 122 /** 123 * <p>Name of the Product the updated Line Item is based on.</p> 124 * @param builder function to build the lineItem value 125 * @return Builder 126 */ 127 128 public SetLineItemProductSlugChangeBuilder 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 updated Line Item is based on.</p> 136 * @param builder function to build the lineItem value 137 * @return Builder 138 */ 139 140 public SetLineItemProductSlugChangeBuilder 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 updated Line Item is based on.</p> 148 * @param lineItem value to be set 149 * @return Builder 150 */ 151 152 public SetLineItemProductSlugChangeBuilder lineItem( 153 final com.commercetools.history.models.common.LocalizedString lineItem) { 154 this.lineItem = lineItem; 155 return this; 156 } 157 158 /** 159 * <p><code>sku</code> or <code>key</code> of the updated ProductVariant.</p> 160 * @param variant value to be set 161 * @return Builder 162 */ 163 164 public SetLineItemProductSlugChangeBuilder variant(final String variant) { 165 this.variant = variant; 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.LocalizedString 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.LocalizedString getNextValue() { 193 return this.nextValue; 194 } 195 196 /** 197 * <p>Name of the Product the updated 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>sku</code> or <code>key</code> of the updated ProductVariant.</p> 207 * @return variant 208 */ 209 210 public String getVariant() { 211 return this.variant; 212 } 213 214 /** 215 * builds SetLineItemProductSlugChange with checking for non-null required values 216 * @return SetLineItemProductSlugChange 217 */ 218 public SetLineItemProductSlugChange build() { 219 Objects.requireNonNull(change, SetLineItemProductSlugChange.class + ": change is missing"); 220 Objects.requireNonNull(previousValue, SetLineItemProductSlugChange.class + ": previousValue is missing"); 221 Objects.requireNonNull(nextValue, SetLineItemProductSlugChange.class + ": nextValue is missing"); 222 Objects.requireNonNull(lineItem, SetLineItemProductSlugChange.class + ": lineItem is missing"); 223 Objects.requireNonNull(variant, SetLineItemProductSlugChange.class + ": variant is missing"); 224 return new SetLineItemProductSlugChangeImpl(change, previousValue, nextValue, lineItem, variant); 225 } 226 227 /** 228 * builds SetLineItemProductSlugChange without checking for non-null required values 229 * @return SetLineItemProductSlugChange 230 */ 231 public SetLineItemProductSlugChange buildUnchecked() { 232 return new SetLineItemProductSlugChangeImpl(change, previousValue, nextValue, lineItem, variant); 233 } 234 235 /** 236 * factory method for an instance of SetLineItemProductSlugChangeBuilder 237 * @return builder 238 */ 239 public static SetLineItemProductSlugChangeBuilder of() { 240 return new SetLineItemProductSlugChangeBuilder(); 241 } 242 243 /** 244 * create builder for SetLineItemProductSlugChange instance 245 * @param template instance with prefilled values for the builder 246 * @return builder 247 */ 248 public static SetLineItemProductSlugChangeBuilder of(final SetLineItemProductSlugChange template) { 249 SetLineItemProductSlugChangeBuilder builder = new SetLineItemProductSlugChangeBuilder(); 250 builder.change = template.getChange(); 251 builder.previousValue = template.getPreviousValue(); 252 builder.nextValue = template.getNextValue(); 253 builder.lineItem = template.getLineItem(); 254 builder.variant = template.getVariant(); 255 return builder; 256 } 257 258}