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 * RemoveImageChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * RemoveImageChange removeImageChange = RemoveImageChange.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 RemoveImageChangeBuilder implements Builder<RemoveImageChange> { 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 RemoveImageChangeBuilder 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 RemoveImageChangeBuilder 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 RemoveImageChangeBuilder 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 RemoveImageChangeBuilder 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 RemoveImageChangeBuilder 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 RemoveImageChangeBuilder 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 RemoveImageChangeBuilder 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 RemoveImageChangeBuilder 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 RemoveImageChangeBuilder nextValue(final com.commercetools.history.models.common.Image... nextValue) { 143 this.nextValue = new ArrayList<>(Arrays.asList(nextValue)); 144 return this; 145 } 146 147 /** 148 * <p>Value after the change.</p> 149 * @param nextValue value to be set 150 * @return Builder 151 */ 152 153 public RemoveImageChangeBuilder nextValue( 154 final java.util.List<com.commercetools.history.models.common.Image> nextValue) { 155 this.nextValue = nextValue; 156 return this; 157 } 158 159 /** 160 * <p>Value after the change.</p> 161 * @param nextValue value to be set 162 * @return Builder 163 */ 164 165 public RemoveImageChangeBuilder plusNextValue(final com.commercetools.history.models.common.Image... nextValue) { 166 if (this.nextValue == null) { 167 this.nextValue = new ArrayList<>(); 168 } 169 this.nextValue.addAll(Arrays.asList(nextValue)); 170 return this; 171 } 172 173 /** 174 * <p>Value after the change.</p> 175 * @param builder function to build the nextValue value 176 * @return Builder 177 */ 178 179 public RemoveImageChangeBuilder plusNextValue( 180 Function<com.commercetools.history.models.common.ImageBuilder, com.commercetools.history.models.common.ImageBuilder> builder) { 181 if (this.nextValue == null) { 182 this.nextValue = new ArrayList<>(); 183 } 184 this.nextValue.add(builder.apply(com.commercetools.history.models.common.ImageBuilder.of()).build()); 185 return this; 186 } 187 188 /** 189 * <p>Value after the change.</p> 190 * @param builder function to build the nextValue value 191 * @return Builder 192 */ 193 194 public RemoveImageChangeBuilder withNextValue( 195 Function<com.commercetools.history.models.common.ImageBuilder, com.commercetools.history.models.common.ImageBuilder> builder) { 196 this.nextValue = new ArrayList<>(); 197 this.nextValue.add(builder.apply(com.commercetools.history.models.common.ImageBuilder.of()).build()); 198 return this; 199 } 200 201 /** 202 * <p>Value after the change.</p> 203 * @param builder function to build the nextValue value 204 * @return Builder 205 */ 206 207 public RemoveImageChangeBuilder addNextValue( 208 Function<com.commercetools.history.models.common.ImageBuilder, com.commercetools.history.models.common.Image> builder) { 209 return plusNextValue(builder.apply(com.commercetools.history.models.common.ImageBuilder.of())); 210 } 211 212 /** 213 * <p>Value after the change.</p> 214 * @param builder function to build the nextValue value 215 * @return Builder 216 */ 217 218 public RemoveImageChangeBuilder setNextValue( 219 Function<com.commercetools.history.models.common.ImageBuilder, com.commercetools.history.models.common.Image> builder) { 220 return nextValue(builder.apply(com.commercetools.history.models.common.ImageBuilder.of())); 221 } 222 223 /** 224 * <ul> 225 * <li><code>staged</code>, if the staged ProductCatalogData was updated.</li> 226 * <li><code>current</code>, if the current ProductCatalogData was updated.</li> 227 * </ul> 228 * @param catalogData value to be set 229 * @return Builder 230 */ 231 232 public RemoveImageChangeBuilder catalogData(final String catalogData) { 233 this.catalogData = catalogData; 234 return this; 235 } 236 237 /** 238 * value of change} 239 * @return change 240 */ 241 242 public String getChange() { 243 return this.change; 244 } 245 246 /** 247 * <p>Value before the change.</p> 248 * @return previousValue 249 */ 250 251 public java.util.List<com.commercetools.history.models.common.Image> getPreviousValue() { 252 return this.previousValue; 253 } 254 255 /** 256 * <p>Value after the change.</p> 257 * @return nextValue 258 */ 259 260 public java.util.List<com.commercetools.history.models.common.Image> getNextValue() { 261 return this.nextValue; 262 } 263 264 /** 265 * <ul> 266 * <li><code>staged</code>, if the staged ProductCatalogData was updated.</li> 267 * <li><code>current</code>, if the current ProductCatalogData was updated.</li> 268 * </ul> 269 * @return catalogData 270 */ 271 272 public String getCatalogData() { 273 return this.catalogData; 274 } 275 276 /** 277 * builds RemoveImageChange with checking for non-null required values 278 * @return RemoveImageChange 279 */ 280 public RemoveImageChange build() { 281 Objects.requireNonNull(change, RemoveImageChange.class + ": change is missing"); 282 Objects.requireNonNull(previousValue, RemoveImageChange.class + ": previousValue is missing"); 283 Objects.requireNonNull(nextValue, RemoveImageChange.class + ": nextValue is missing"); 284 Objects.requireNonNull(catalogData, RemoveImageChange.class + ": catalogData is missing"); 285 return new RemoveImageChangeImpl(change, previousValue, nextValue, catalogData); 286 } 287 288 /** 289 * builds RemoveImageChange without checking for non-null required values 290 * @return RemoveImageChange 291 */ 292 public RemoveImageChange buildUnchecked() { 293 return new RemoveImageChangeImpl(change, previousValue, nextValue, catalogData); 294 } 295 296 /** 297 * factory method for an instance of RemoveImageChangeBuilder 298 * @return builder 299 */ 300 public static RemoveImageChangeBuilder of() { 301 return new RemoveImageChangeBuilder(); 302 } 303 304 /** 305 * create builder for RemoveImageChange instance 306 * @param template instance with prefilled values for the builder 307 * @return builder 308 */ 309 public static RemoveImageChangeBuilder of(final RemoveImageChange template) { 310 RemoveImageChangeBuilder builder = new RemoveImageChangeBuilder(); 311 builder.change = template.getChange(); 312 builder.previousValue = template.getPreviousValue(); 313 builder.nextValue = template.getNextValue(); 314 builder.catalogData = template.getCatalogData(); 315 return builder; 316 } 317 318}