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 * ChangeAssetOrderChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * ChangeAssetOrderChange changeAssetOrderChange = ChangeAssetOrderChange.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 ChangeAssetOrderChangeBuilder implements Builder<ChangeAssetOrderChange> { 026 027 private String change; 028 029 private java.util.List<com.commercetools.history.models.common.LocalizedString> previousValue; 030 031 private java.util.List<com.commercetools.history.models.common.LocalizedString> nextValue; 032 033 /** 034 * set the value to the change 035 * @param change value to be set 036 * @return Builder 037 */ 038 039 public ChangeAssetOrderChangeBuilder 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 ChangeAssetOrderChangeBuilder previousValue( 051 final com.commercetools.history.models.common.LocalizedString... 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 ChangeAssetOrderChangeBuilder previousValue( 063 final java.util.List<com.commercetools.history.models.common.LocalizedString> 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 ChangeAssetOrderChangeBuilder plusPreviousValue( 075 final com.commercetools.history.models.common.LocalizedString... 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 ChangeAssetOrderChangeBuilder plusPreviousValue( 090 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedStringBuilder> builder) { 091 if (this.previousValue == null) { 092 this.previousValue = new ArrayList<>(); 093 } 094 this.previousValue 095 .add(builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()).build()); 096 return this; 097 } 098 099 /** 100 * <p>Value before the change.</p> 101 * @param builder function to build the previousValue value 102 * @return Builder 103 */ 104 105 public ChangeAssetOrderChangeBuilder withPreviousValue( 106 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedStringBuilder> builder) { 107 this.previousValue = new ArrayList<>(); 108 this.previousValue 109 .add(builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()).build()); 110 return this; 111 } 112 113 /** 114 * <p>Value before the change.</p> 115 * @param builder function to build the previousValue value 116 * @return Builder 117 */ 118 119 public ChangeAssetOrderChangeBuilder addPreviousValue( 120 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedString> builder) { 121 return plusPreviousValue(builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of())); 122 } 123 124 /** 125 * <p>Value before the change.</p> 126 * @param builder function to build the previousValue value 127 * @return Builder 128 */ 129 130 public ChangeAssetOrderChangeBuilder setPreviousValue( 131 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedString> builder) { 132 return previousValue(builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of())); 133 } 134 135 /** 136 * <p>Value after the change.</p> 137 * @param nextValue value to be set 138 * @return Builder 139 */ 140 141 public ChangeAssetOrderChangeBuilder nextValue( 142 final com.commercetools.history.models.common.LocalizedString... 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 ChangeAssetOrderChangeBuilder nextValue( 154 final java.util.List<com.commercetools.history.models.common.LocalizedString> 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 ChangeAssetOrderChangeBuilder plusNextValue( 166 final com.commercetools.history.models.common.LocalizedString... nextValue) { 167 if (this.nextValue == null) { 168 this.nextValue = new ArrayList<>(); 169 } 170 this.nextValue.addAll(Arrays.asList(nextValue)); 171 return this; 172 } 173 174 /** 175 * <p>Value after the change.</p> 176 * @param builder function to build the nextValue value 177 * @return Builder 178 */ 179 180 public ChangeAssetOrderChangeBuilder plusNextValue( 181 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedStringBuilder> builder) { 182 if (this.nextValue == null) { 183 this.nextValue = new ArrayList<>(); 184 } 185 this.nextValue.add(builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()).build()); 186 return this; 187 } 188 189 /** 190 * <p>Value after the change.</p> 191 * @param builder function to build the nextValue value 192 * @return Builder 193 */ 194 195 public ChangeAssetOrderChangeBuilder withNextValue( 196 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedStringBuilder> builder) { 197 this.nextValue = new ArrayList<>(); 198 this.nextValue.add(builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()).build()); 199 return this; 200 } 201 202 /** 203 * <p>Value after the change.</p> 204 * @param builder function to build the nextValue value 205 * @return Builder 206 */ 207 208 public ChangeAssetOrderChangeBuilder addNextValue( 209 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedString> builder) { 210 return plusNextValue(builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of())); 211 } 212 213 /** 214 * <p>Value after the change.</p> 215 * @param builder function to build the nextValue value 216 * @return Builder 217 */ 218 219 public ChangeAssetOrderChangeBuilder setNextValue( 220 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedString> builder) { 221 return nextValue(builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of())); 222 } 223 224 /** 225 * value of change} 226 * @return change 227 */ 228 229 public String getChange() { 230 return this.change; 231 } 232 233 /** 234 * <p>Value before the change.</p> 235 * @return previousValue 236 */ 237 238 public java.util.List<com.commercetools.history.models.common.LocalizedString> getPreviousValue() { 239 return this.previousValue; 240 } 241 242 /** 243 * <p>Value after the change.</p> 244 * @return nextValue 245 */ 246 247 public java.util.List<com.commercetools.history.models.common.LocalizedString> getNextValue() { 248 return this.nextValue; 249 } 250 251 /** 252 * builds ChangeAssetOrderChange with checking for non-null required values 253 * @return ChangeAssetOrderChange 254 */ 255 public ChangeAssetOrderChange build() { 256 Objects.requireNonNull(change, ChangeAssetOrderChange.class + ": change is missing"); 257 Objects.requireNonNull(previousValue, ChangeAssetOrderChange.class + ": previousValue is missing"); 258 Objects.requireNonNull(nextValue, ChangeAssetOrderChange.class + ": nextValue is missing"); 259 return new ChangeAssetOrderChangeImpl(change, previousValue, nextValue); 260 } 261 262 /** 263 * builds ChangeAssetOrderChange without checking for non-null required values 264 * @return ChangeAssetOrderChange 265 */ 266 public ChangeAssetOrderChange buildUnchecked() { 267 return new ChangeAssetOrderChangeImpl(change, previousValue, nextValue); 268 } 269 270 /** 271 * factory method for an instance of ChangeAssetOrderChangeBuilder 272 * @return builder 273 */ 274 public static ChangeAssetOrderChangeBuilder of() { 275 return new ChangeAssetOrderChangeBuilder(); 276 } 277 278 /** 279 * create builder for ChangeAssetOrderChange instance 280 * @param template instance with prefilled values for the builder 281 * @return builder 282 */ 283 public static ChangeAssetOrderChangeBuilder of(final ChangeAssetOrderChange template) { 284 ChangeAssetOrderChangeBuilder builder = new ChangeAssetOrderChangeBuilder(); 285 builder.change = template.getChange(); 286 builder.previousValue = template.getPreviousValue(); 287 builder.nextValue = template.getNextValue(); 288 return builder; 289 } 290 291}