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