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 * SetCustomLineItemCustomTypeChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * SetCustomLineItemCustomTypeChange setCustomLineItemCustomTypeChange = SetCustomLineItemCustomTypeChange.builder() 017 * .change("{change}") 018 * .previousValue(previousValueBuilder -> previousValueBuilder) 019 * .nextValue(nextValueBuilder -> nextValueBuilder) 020 * .customLineItem(customLineItemBuilder -> customLineItemBuilder) 021 * .customLineItemId("{customLineItemId}") 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 SetCustomLineItemCustomTypeChangeBuilder implements Builder<SetCustomLineItemCustomTypeChange> { 028 029 private String change; 030 031 private com.commercetools.history.models.common.CustomFields previousValue; 032 033 private com.commercetools.history.models.common.CustomFields nextValue; 034 035 private com.commercetools.history.models.common.LocalizedString customLineItem; 036 037 private String customLineItemId; 038 039 /** 040 * set the value to the change 041 * @param change value to be set 042 * @return Builder 043 */ 044 045 public SetCustomLineItemCustomTypeChangeBuilder 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 SetCustomLineItemCustomTypeChangeBuilder previousValue( 057 Function<com.commercetools.history.models.common.CustomFieldsBuilder, com.commercetools.history.models.common.CustomFieldsBuilder> builder) { 058 this.previousValue = builder.apply(com.commercetools.history.models.common.CustomFieldsBuilder.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 SetCustomLineItemCustomTypeChangeBuilder withPreviousValue( 069 Function<com.commercetools.history.models.common.CustomFieldsBuilder, com.commercetools.history.models.common.CustomFields> builder) { 070 this.previousValue = builder.apply(com.commercetools.history.models.common.CustomFieldsBuilder.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 SetCustomLineItemCustomTypeChangeBuilder previousValue( 081 final com.commercetools.history.models.common.CustomFields 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 SetCustomLineItemCustomTypeChangeBuilder nextValue( 093 Function<com.commercetools.history.models.common.CustomFieldsBuilder, com.commercetools.history.models.common.CustomFieldsBuilder> builder) { 094 this.nextValue = builder.apply(com.commercetools.history.models.common.CustomFieldsBuilder.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 SetCustomLineItemCustomTypeChangeBuilder withNextValue( 105 Function<com.commercetools.history.models.common.CustomFieldsBuilder, com.commercetools.history.models.common.CustomFields> builder) { 106 this.nextValue = builder.apply(com.commercetools.history.models.common.CustomFieldsBuilder.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 SetCustomLineItemCustomTypeChangeBuilder nextValue( 117 final com.commercetools.history.models.common.CustomFields nextValue) { 118 this.nextValue = nextValue; 119 return this; 120 } 121 122 /** 123 * <p>Name of the updated CustomLineItem.</p> 124 * @param builder function to build the customLineItem value 125 * @return Builder 126 */ 127 128 public SetCustomLineItemCustomTypeChangeBuilder customLineItem( 129 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedStringBuilder> builder) { 130 this.customLineItem = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()) 131 .build(); 132 return this; 133 } 134 135 /** 136 * <p>Name of the updated CustomLineItem.</p> 137 * @param builder function to build the customLineItem value 138 * @return Builder 139 */ 140 141 public SetCustomLineItemCustomTypeChangeBuilder withCustomLineItem( 142 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedString> builder) { 143 this.customLineItem = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()); 144 return this; 145 } 146 147 /** 148 * <p>Name of the updated CustomLineItem.</p> 149 * @param customLineItem value to be set 150 * @return Builder 151 */ 152 153 public SetCustomLineItemCustomTypeChangeBuilder customLineItem( 154 final com.commercetools.history.models.common.LocalizedString customLineItem) { 155 this.customLineItem = customLineItem; 156 return this; 157 } 158 159 /** 160 * <p><code>id</code> of the updated CustomLineItem.</p> 161 * @param customLineItemId value to be set 162 * @return Builder 163 */ 164 165 public SetCustomLineItemCustomTypeChangeBuilder customLineItemId(final String customLineItemId) { 166 this.customLineItemId = customLineItemId; 167 return this; 168 } 169 170 /** 171 * value of change} 172 * @return change 173 */ 174 175 public String getChange() { 176 return this.change; 177 } 178 179 /** 180 * <p>Value before the change.</p> 181 * @return previousValue 182 */ 183 184 public com.commercetools.history.models.common.CustomFields getPreviousValue() { 185 return this.previousValue; 186 } 187 188 /** 189 * <p>Value after the change.</p> 190 * @return nextValue 191 */ 192 193 public com.commercetools.history.models.common.CustomFields getNextValue() { 194 return this.nextValue; 195 } 196 197 /** 198 * <p>Name of the updated CustomLineItem.</p> 199 * @return customLineItem 200 */ 201 202 public com.commercetools.history.models.common.LocalizedString getCustomLineItem() { 203 return this.customLineItem; 204 } 205 206 /** 207 * <p><code>id</code> of the updated CustomLineItem.</p> 208 * @return customLineItemId 209 */ 210 211 public String getCustomLineItemId() { 212 return this.customLineItemId; 213 } 214 215 /** 216 * builds SetCustomLineItemCustomTypeChange with checking for non-null required values 217 * @return SetCustomLineItemCustomTypeChange 218 */ 219 public SetCustomLineItemCustomTypeChange build() { 220 Objects.requireNonNull(change, SetCustomLineItemCustomTypeChange.class + ": change is missing"); 221 Objects.requireNonNull(previousValue, SetCustomLineItemCustomTypeChange.class + ": previousValue is missing"); 222 Objects.requireNonNull(nextValue, SetCustomLineItemCustomTypeChange.class + ": nextValue is missing"); 223 Objects.requireNonNull(customLineItem, SetCustomLineItemCustomTypeChange.class + ": customLineItem is missing"); 224 Objects.requireNonNull(customLineItemId, 225 SetCustomLineItemCustomTypeChange.class + ": customLineItemId is missing"); 226 return new SetCustomLineItemCustomTypeChangeImpl(change, previousValue, nextValue, customLineItem, 227 customLineItemId); 228 } 229 230 /** 231 * builds SetCustomLineItemCustomTypeChange without checking for non-null required values 232 * @return SetCustomLineItemCustomTypeChange 233 */ 234 public SetCustomLineItemCustomTypeChange buildUnchecked() { 235 return new SetCustomLineItemCustomTypeChangeImpl(change, previousValue, nextValue, customLineItem, 236 customLineItemId); 237 } 238 239 /** 240 * factory method for an instance of SetCustomLineItemCustomTypeChangeBuilder 241 * @return builder 242 */ 243 public static SetCustomLineItemCustomTypeChangeBuilder of() { 244 return new SetCustomLineItemCustomTypeChangeBuilder(); 245 } 246 247 /** 248 * create builder for SetCustomLineItemCustomTypeChange instance 249 * @param template instance with prefilled values for the builder 250 * @return builder 251 */ 252 public static SetCustomLineItemCustomTypeChangeBuilder of(final SetCustomLineItemCustomTypeChange template) { 253 SetCustomLineItemCustomTypeChangeBuilder builder = new SetCustomLineItemCustomTypeChangeBuilder(); 254 builder.change = template.getChange(); 255 builder.previousValue = template.getPreviousValue(); 256 builder.nextValue = template.getNextValue(); 257 builder.customLineItem = template.getCustomLineItem(); 258 builder.customLineItemId = template.getCustomLineItemId(); 259 return builder; 260 } 261 262}