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 * AddBillingAddressIdChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * AddBillingAddressIdChange addBillingAddressIdChange = AddBillingAddressIdChange.builder() 017 * .change("{change}") 018 * .plusPreviousValue(previousValueBuilder -> previousValueBuilder) 019 * .plusNextValue(nextValueBuilder -> nextValueBuilder) 020 * .address(addressBuilder -> addressBuilder) 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 AddBillingAddressIdChangeBuilder implements Builder<AddBillingAddressIdChange> { 027 028 private String change; 029 030 private java.util.List<String> previousValue; 031 032 private java.util.List<String> nextValue; 033 034 private com.commercetools.history.models.common.Address address; 035 036 /** 037 * set the value to the change 038 * @param change value to be set 039 * @return Builder 040 */ 041 042 public AddBillingAddressIdChangeBuilder 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 AddBillingAddressIdChangeBuilder previousValue(final String... previousValue) { 054 this.previousValue = new ArrayList<>(Arrays.asList(previousValue)); 055 return this; 056 } 057 058 /** 059 * <p>Value before the change.</p> 060 * @param previousValue value to be set 061 * @return Builder 062 */ 063 064 public AddBillingAddressIdChangeBuilder previousValue(final java.util.List<String> previousValue) { 065 this.previousValue = previousValue; 066 return this; 067 } 068 069 /** 070 * <p>Value before the change.</p> 071 * @param previousValue value to be set 072 * @return Builder 073 */ 074 075 public AddBillingAddressIdChangeBuilder plusPreviousValue(final String... 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 after the change.</p> 085 * @param nextValue value to be set 086 * @return Builder 087 */ 088 089 public AddBillingAddressIdChangeBuilder nextValue(final String... nextValue) { 090 this.nextValue = new ArrayList<>(Arrays.asList(nextValue)); 091 return this; 092 } 093 094 /** 095 * <p>Value after the change.</p> 096 * @param nextValue value to be set 097 * @return Builder 098 */ 099 100 public AddBillingAddressIdChangeBuilder nextValue(final java.util.List<String> nextValue) { 101 this.nextValue = nextValue; 102 return this; 103 } 104 105 /** 106 * <p>Value after the change.</p> 107 * @param nextValue value to be set 108 * @return Builder 109 */ 110 111 public AddBillingAddressIdChangeBuilder plusNextValue(final String... nextValue) { 112 if (this.nextValue == null) { 113 this.nextValue = new ArrayList<>(); 114 } 115 this.nextValue.addAll(Arrays.asList(nextValue)); 116 return this; 117 } 118 119 /** 120 * <p>Address added to <code>billingAddressIds</code>.</p> 121 * @param builder function to build the address value 122 * @return Builder 123 */ 124 125 public AddBillingAddressIdChangeBuilder address( 126 Function<com.commercetools.history.models.common.AddressBuilder, com.commercetools.history.models.common.AddressBuilder> builder) { 127 this.address = builder.apply(com.commercetools.history.models.common.AddressBuilder.of()).build(); 128 return this; 129 } 130 131 /** 132 * <p>Address added to <code>billingAddressIds</code>.</p> 133 * @param builder function to build the address value 134 * @return Builder 135 */ 136 137 public AddBillingAddressIdChangeBuilder withAddress( 138 Function<com.commercetools.history.models.common.AddressBuilder, com.commercetools.history.models.common.Address> builder) { 139 this.address = builder.apply(com.commercetools.history.models.common.AddressBuilder.of()); 140 return this; 141 } 142 143 /** 144 * <p>Address added to <code>billingAddressIds</code>.</p> 145 * @param address value to be set 146 * @return Builder 147 */ 148 149 public AddBillingAddressIdChangeBuilder address(final com.commercetools.history.models.common.Address address) { 150 this.address = address; 151 return this; 152 } 153 154 /** 155 * value of change} 156 * @return change 157 */ 158 159 public String getChange() { 160 return this.change; 161 } 162 163 /** 164 * <p>Value before the change.</p> 165 * @return previousValue 166 */ 167 168 public java.util.List<String> getPreviousValue() { 169 return this.previousValue; 170 } 171 172 /** 173 * <p>Value after the change.</p> 174 * @return nextValue 175 */ 176 177 public java.util.List<String> getNextValue() { 178 return this.nextValue; 179 } 180 181 /** 182 * <p>Address added to <code>billingAddressIds</code>.</p> 183 * @return address 184 */ 185 186 public com.commercetools.history.models.common.Address getAddress() { 187 return this.address; 188 } 189 190 /** 191 * builds AddBillingAddressIdChange with checking for non-null required values 192 * @return AddBillingAddressIdChange 193 */ 194 public AddBillingAddressIdChange build() { 195 Objects.requireNonNull(change, AddBillingAddressIdChange.class + ": change is missing"); 196 Objects.requireNonNull(previousValue, AddBillingAddressIdChange.class + ": previousValue is missing"); 197 Objects.requireNonNull(nextValue, AddBillingAddressIdChange.class + ": nextValue is missing"); 198 Objects.requireNonNull(address, AddBillingAddressIdChange.class + ": address is missing"); 199 return new AddBillingAddressIdChangeImpl(change, previousValue, nextValue, address); 200 } 201 202 /** 203 * builds AddBillingAddressIdChange without checking for non-null required values 204 * @return AddBillingAddressIdChange 205 */ 206 public AddBillingAddressIdChange buildUnchecked() { 207 return new AddBillingAddressIdChangeImpl(change, previousValue, nextValue, address); 208 } 209 210 /** 211 * factory method for an instance of AddBillingAddressIdChangeBuilder 212 * @return builder 213 */ 214 public static AddBillingAddressIdChangeBuilder of() { 215 return new AddBillingAddressIdChangeBuilder(); 216 } 217 218 /** 219 * create builder for AddBillingAddressIdChange instance 220 * @param template instance with prefilled values for the builder 221 * @return builder 222 */ 223 public static AddBillingAddressIdChangeBuilder of(final AddBillingAddressIdChange template) { 224 AddBillingAddressIdChangeBuilder builder = new AddBillingAddressIdChangeBuilder(); 225 builder.change = template.getChange(); 226 builder.previousValue = template.getPreviousValue(); 227 builder.nextValue = template.getNextValue(); 228 builder.address = template.getAddress(); 229 return builder; 230 } 231 232}