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 * AddPriceChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * AddPriceChange addPriceChange = AddPriceChange.builder() 017 * .change("{change}") 018 * .nextValue(nextValueBuilder -> nextValueBuilder) 019 * .catalogData("{catalogData}") 020 * .priceId("{priceId}") 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 AddPriceChangeBuilder implements Builder<AddPriceChange> { 027 028 private String change; 029 030 private com.commercetools.history.models.common.Price nextValue; 031 032 private String catalogData; 033 034 private String priceId; 035 036 /** 037 * set the value to the change 038 * @param change value to be set 039 * @return Builder 040 */ 041 042 public AddPriceChangeBuilder change(final String change) { 043 this.change = change; 044 return this; 045 } 046 047 /** 048 * <p>Value after the change.</p> 049 * @param builder function to build the nextValue value 050 * @return Builder 051 */ 052 053 public AddPriceChangeBuilder nextValue( 054 Function<com.commercetools.history.models.common.PriceBuilder, com.commercetools.history.models.common.PriceBuilder> builder) { 055 this.nextValue = builder.apply(com.commercetools.history.models.common.PriceBuilder.of()).build(); 056 return this; 057 } 058 059 /** 060 * <p>Value after the change.</p> 061 * @param builder function to build the nextValue value 062 * @return Builder 063 */ 064 065 public AddPriceChangeBuilder withNextValue( 066 Function<com.commercetools.history.models.common.PriceBuilder, com.commercetools.history.models.common.Price> builder) { 067 this.nextValue = builder.apply(com.commercetools.history.models.common.PriceBuilder.of()); 068 return this; 069 } 070 071 /** 072 * <p>Value after the change.</p> 073 * @param nextValue value to be set 074 * @return Builder 075 */ 076 077 public AddPriceChangeBuilder nextValue(final com.commercetools.history.models.common.Price nextValue) { 078 this.nextValue = nextValue; 079 return this; 080 } 081 082 /** 083 * <ul> 084 * <li><code>staged</code>, if the staged ProductCatalogData was updated.</li> 085 * <li><code>current</code>, if the current ProductCatalogData was updated.</li> 086 * </ul> 087 * @param catalogData value to be set 088 * @return Builder 089 */ 090 091 public AddPriceChangeBuilder catalogData(final String catalogData) { 092 this.catalogData = catalogData; 093 return this; 094 } 095 096 /** 097 * <p><code>id</code> of the Embedded Price.</p> 098 * @param priceId value to be set 099 * @return Builder 100 */ 101 102 public AddPriceChangeBuilder priceId(final String priceId) { 103 this.priceId = priceId; 104 return this; 105 } 106 107 /** 108 * value of change} 109 * @return change 110 */ 111 112 public String getChange() { 113 return this.change; 114 } 115 116 /** 117 * <p>Value after the change.</p> 118 * @return nextValue 119 */ 120 121 public com.commercetools.history.models.common.Price getNextValue() { 122 return this.nextValue; 123 } 124 125 /** 126 * <ul> 127 * <li><code>staged</code>, if the staged ProductCatalogData was updated.</li> 128 * <li><code>current</code>, if the current ProductCatalogData was updated.</li> 129 * </ul> 130 * @return catalogData 131 */ 132 133 public String getCatalogData() { 134 return this.catalogData; 135 } 136 137 /** 138 * <p><code>id</code> of the Embedded Price.</p> 139 * @return priceId 140 */ 141 142 public String getPriceId() { 143 return this.priceId; 144 } 145 146 /** 147 * builds AddPriceChange with checking for non-null required values 148 * @return AddPriceChange 149 */ 150 public AddPriceChange build() { 151 Objects.requireNonNull(change, AddPriceChange.class + ": change is missing"); 152 Objects.requireNonNull(nextValue, AddPriceChange.class + ": nextValue is missing"); 153 Objects.requireNonNull(catalogData, AddPriceChange.class + ": catalogData is missing"); 154 Objects.requireNonNull(priceId, AddPriceChange.class + ": priceId is missing"); 155 return new AddPriceChangeImpl(change, nextValue, catalogData, priceId); 156 } 157 158 /** 159 * builds AddPriceChange without checking for non-null required values 160 * @return AddPriceChange 161 */ 162 public AddPriceChange buildUnchecked() { 163 return new AddPriceChangeImpl(change, nextValue, catalogData, priceId); 164 } 165 166 /** 167 * factory method for an instance of AddPriceChangeBuilder 168 * @return builder 169 */ 170 public static AddPriceChangeBuilder of() { 171 return new AddPriceChangeBuilder(); 172 } 173 174 /** 175 * create builder for AddPriceChange instance 176 * @param template instance with prefilled values for the builder 177 * @return builder 178 */ 179 public static AddPriceChangeBuilder of(final AddPriceChange template) { 180 AddPriceChangeBuilder builder = new AddPriceChangeBuilder(); 181 builder.change = template.getChange(); 182 builder.nextValue = template.getNextValue(); 183 builder.catalogData = template.getCatalogData(); 184 builder.priceId = template.getPriceId(); 185 return builder; 186 } 187 188}