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 * SetProductPriceCustomFieldChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * SetProductPriceCustomFieldChange setProductPriceCustomFieldChange = SetProductPriceCustomFieldChange.builder() 017 * .change("{change}") 018 * .previousValue(previousValueBuilder -> previousValueBuilder) 019 * .nextValue(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 SetProductPriceCustomFieldChangeBuilder implements Builder<SetProductPriceCustomFieldChange> { 027 028 private String change; 029 030 private com.commercetools.history.models.common.CustomFields previousValue; 031 032 private com.commercetools.history.models.common.CustomFields 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 SetProductPriceCustomFieldChangeBuilder change(final String change) { 043 this.change = change; 044 return this; 045 } 046 047 /** 048 * <p>Value before the change.</p> 049 * @param builder function to build the previousValue value 050 * @return Builder 051 */ 052 053 public SetProductPriceCustomFieldChangeBuilder previousValue( 054 Function<com.commercetools.history.models.common.CustomFieldsBuilder, com.commercetools.history.models.common.CustomFieldsBuilder> builder) { 055 this.previousValue = builder.apply(com.commercetools.history.models.common.CustomFieldsBuilder.of()).build(); 056 return this; 057 } 058 059 /** 060 * <p>Value before the change.</p> 061 * @param builder function to build the previousValue value 062 * @return Builder 063 */ 064 065 public SetProductPriceCustomFieldChangeBuilder withPreviousValue( 066 Function<com.commercetools.history.models.common.CustomFieldsBuilder, com.commercetools.history.models.common.CustomFields> builder) { 067 this.previousValue = builder.apply(com.commercetools.history.models.common.CustomFieldsBuilder.of()); 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 SetProductPriceCustomFieldChangeBuilder previousValue( 078 final com.commercetools.history.models.common.CustomFields previousValue) { 079 this.previousValue = previousValue; 080 return this; 081 } 082 083 /** 084 * <p>Value after the change.</p> 085 * @param builder function to build the nextValue value 086 * @return Builder 087 */ 088 089 public SetProductPriceCustomFieldChangeBuilder nextValue( 090 Function<com.commercetools.history.models.common.CustomFieldsBuilder, com.commercetools.history.models.common.CustomFieldsBuilder> builder) { 091 this.nextValue = builder.apply(com.commercetools.history.models.common.CustomFieldsBuilder.of()).build(); 092 return this; 093 } 094 095 /** 096 * <p>Value after the change.</p> 097 * @param builder function to build the nextValue value 098 * @return Builder 099 */ 100 101 public SetProductPriceCustomFieldChangeBuilder withNextValue( 102 Function<com.commercetools.history.models.common.CustomFieldsBuilder, com.commercetools.history.models.common.CustomFields> builder) { 103 this.nextValue = builder.apply(com.commercetools.history.models.common.CustomFieldsBuilder.of()); 104 return this; 105 } 106 107 /** 108 * <p>Value after the change.</p> 109 * @param nextValue value to be set 110 * @return Builder 111 */ 112 113 public SetProductPriceCustomFieldChangeBuilder nextValue( 114 final com.commercetools.history.models.common.CustomFields nextValue) { 115 this.nextValue = nextValue; 116 return this; 117 } 118 119 /** 120 * <ul> 121 * <li><code>staged</code>, if the staged ProductCatalogData was updated.</li> 122 * <li><code>current</code>, if the current ProductCatalogData was updated.</li> 123 * </ul> 124 * @param catalogData value to be set 125 * @return Builder 126 */ 127 128 public SetProductPriceCustomFieldChangeBuilder catalogData(final String catalogData) { 129 this.catalogData = catalogData; 130 return this; 131 } 132 133 /** 134 * value of change} 135 * @return change 136 */ 137 138 public String getChange() { 139 return this.change; 140 } 141 142 /** 143 * <p>Value before the change.</p> 144 * @return previousValue 145 */ 146 147 public com.commercetools.history.models.common.CustomFields getPreviousValue() { 148 return this.previousValue; 149 } 150 151 /** 152 * <p>Value after the change.</p> 153 * @return nextValue 154 */ 155 156 public com.commercetools.history.models.common.CustomFields getNextValue() { 157 return this.nextValue; 158 } 159 160 /** 161 * <ul> 162 * <li><code>staged</code>, if the staged ProductCatalogData was updated.</li> 163 * <li><code>current</code>, if the current ProductCatalogData was updated.</li> 164 * </ul> 165 * @return catalogData 166 */ 167 168 public String getCatalogData() { 169 return this.catalogData; 170 } 171 172 /** 173 * builds SetProductPriceCustomFieldChange with checking for non-null required values 174 * @return SetProductPriceCustomFieldChange 175 */ 176 public SetProductPriceCustomFieldChange build() { 177 Objects.requireNonNull(change, SetProductPriceCustomFieldChange.class + ": change is missing"); 178 Objects.requireNonNull(previousValue, SetProductPriceCustomFieldChange.class + ": previousValue is missing"); 179 Objects.requireNonNull(nextValue, SetProductPriceCustomFieldChange.class + ": nextValue is missing"); 180 Objects.requireNonNull(catalogData, SetProductPriceCustomFieldChange.class + ": catalogData is missing"); 181 return new SetProductPriceCustomFieldChangeImpl(change, previousValue, nextValue, catalogData); 182 } 183 184 /** 185 * builds SetProductPriceCustomFieldChange without checking for non-null required values 186 * @return SetProductPriceCustomFieldChange 187 */ 188 public SetProductPriceCustomFieldChange buildUnchecked() { 189 return new SetProductPriceCustomFieldChangeImpl(change, previousValue, nextValue, catalogData); 190 } 191 192 /** 193 * factory method for an instance of SetProductPriceCustomFieldChangeBuilder 194 * @return builder 195 */ 196 public static SetProductPriceCustomFieldChangeBuilder of() { 197 return new SetProductPriceCustomFieldChangeBuilder(); 198 } 199 200 /** 201 * create builder for SetProductPriceCustomFieldChange instance 202 * @param template instance with prefilled values for the builder 203 * @return builder 204 */ 205 public static SetProductPriceCustomFieldChangeBuilder of(final SetProductPriceCustomFieldChange template) { 206 SetProductPriceCustomFieldChangeBuilder builder = new SetProductPriceCustomFieldChangeBuilder(); 207 builder.change = template.getChange(); 208 builder.previousValue = template.getPreviousValue(); 209 builder.nextValue = template.getNextValue(); 210 builder.catalogData = template.getCatalogData(); 211 return builder; 212 } 213 214}