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