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 * SetCustomLineItemTaxCategoryChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * SetCustomLineItemTaxCategoryChange setCustomLineItemTaxCategoryChange = SetCustomLineItemTaxCategoryChange.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 SetCustomLineItemTaxCategoryChangeBuilder implements Builder<SetCustomLineItemTaxCategoryChange> { 028 029 private String change; 030 031 private com.commercetools.history.models.common.Reference previousValue; 032 033 private com.commercetools.history.models.common.Reference 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 SetCustomLineItemTaxCategoryChangeBuilder 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 SetCustomLineItemTaxCategoryChangeBuilder previousValue( 057 Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.ReferenceBuilder> builder) { 058 this.previousValue = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.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 SetCustomLineItemTaxCategoryChangeBuilder withPreviousValue( 069 Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.Reference> builder) { 070 this.previousValue = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.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 SetCustomLineItemTaxCategoryChangeBuilder previousValue( 081 final com.commercetools.history.models.common.Reference 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 SetCustomLineItemTaxCategoryChangeBuilder nextValue( 093 Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.ReferenceBuilder> builder) { 094 this.nextValue = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.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 SetCustomLineItemTaxCategoryChangeBuilder withNextValue( 105 Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.Reference> builder) { 106 this.nextValue = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.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 SetCustomLineItemTaxCategoryChangeBuilder nextValue( 117 final com.commercetools.history.models.common.Reference 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 SetCustomLineItemTaxCategoryChangeBuilder 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 SetCustomLineItemTaxCategoryChangeBuilder 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 SetCustomLineItemTaxCategoryChangeBuilder 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 SetCustomLineItemTaxCategoryChangeBuilder 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.Reference 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.Reference 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 SetCustomLineItemTaxCategoryChange with checking for non-null required values 217 * @return SetCustomLineItemTaxCategoryChange 218 */ 219 public SetCustomLineItemTaxCategoryChange build() { 220 Objects.requireNonNull(change, SetCustomLineItemTaxCategoryChange.class + ": change is missing"); 221 Objects.requireNonNull(previousValue, SetCustomLineItemTaxCategoryChange.class + ": previousValue is missing"); 222 Objects.requireNonNull(nextValue, SetCustomLineItemTaxCategoryChange.class + ": nextValue is missing"); 223 Objects.requireNonNull(customLineItem, 224 SetCustomLineItemTaxCategoryChange.class + ": customLineItem is missing"); 225 Objects.requireNonNull(customLineItemId, 226 SetCustomLineItemTaxCategoryChange.class + ": customLineItemId is missing"); 227 return new SetCustomLineItemTaxCategoryChangeImpl(change, previousValue, nextValue, customLineItem, 228 customLineItemId); 229 } 230 231 /** 232 * builds SetCustomLineItemTaxCategoryChange without checking for non-null required values 233 * @return SetCustomLineItemTaxCategoryChange 234 */ 235 public SetCustomLineItemTaxCategoryChange buildUnchecked() { 236 return new SetCustomLineItemTaxCategoryChangeImpl(change, previousValue, nextValue, customLineItem, 237 customLineItemId); 238 } 239 240 /** 241 * factory method for an instance of SetCustomLineItemTaxCategoryChangeBuilder 242 * @return builder 243 */ 244 public static SetCustomLineItemTaxCategoryChangeBuilder of() { 245 return new SetCustomLineItemTaxCategoryChangeBuilder(); 246 } 247 248 /** 249 * create builder for SetCustomLineItemTaxCategoryChange instance 250 * @param template instance with prefilled values for the builder 251 * @return builder 252 */ 253 public static SetCustomLineItemTaxCategoryChangeBuilder of(final SetCustomLineItemTaxCategoryChange template) { 254 SetCustomLineItemTaxCategoryChangeBuilder builder = new SetCustomLineItemTaxCategoryChangeBuilder(); 255 builder.change = template.getChange(); 256 builder.previousValue = template.getPreviousValue(); 257 builder.nextValue = template.getNextValue(); 258 builder.customLineItem = template.getCustomLineItem(); 259 builder.customLineItemId = template.getCustomLineItemId(); 260 return builder; 261 } 262 263}