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