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 * SetSearchKeywordsChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * SetSearchKeywordsChange setSearchKeywordsChange = SetSearchKeywordsChange.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 SetSearchKeywordsChangeBuilder implements Builder<SetSearchKeywordsChange> { 027 028 private String change; 029 030 private com.commercetools.history.models.common.SearchKeywords previousValue; 031 032 private com.commercetools.history.models.common.SearchKeywords 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 SetSearchKeywordsChangeBuilder 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 SetSearchKeywordsChangeBuilder previousValue( 054 Function<com.commercetools.history.models.common.SearchKeywordsBuilder, com.commercetools.history.models.common.SearchKeywordsBuilder> builder) { 055 this.previousValue = builder.apply(com.commercetools.history.models.common.SearchKeywordsBuilder.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 SetSearchKeywordsChangeBuilder withPreviousValue( 066 Function<com.commercetools.history.models.common.SearchKeywordsBuilder, com.commercetools.history.models.common.SearchKeywords> builder) { 067 this.previousValue = builder.apply(com.commercetools.history.models.common.SearchKeywordsBuilder.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 SetSearchKeywordsChangeBuilder previousValue( 078 final com.commercetools.history.models.common.SearchKeywords 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 SetSearchKeywordsChangeBuilder nextValue( 090 Function<com.commercetools.history.models.common.SearchKeywordsBuilder, com.commercetools.history.models.common.SearchKeywordsBuilder> builder) { 091 this.nextValue = builder.apply(com.commercetools.history.models.common.SearchKeywordsBuilder.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 SetSearchKeywordsChangeBuilder withNextValue( 102 Function<com.commercetools.history.models.common.SearchKeywordsBuilder, com.commercetools.history.models.common.SearchKeywords> builder) { 103 this.nextValue = builder.apply(com.commercetools.history.models.common.SearchKeywordsBuilder.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 SetSearchKeywordsChangeBuilder nextValue( 114 final com.commercetools.history.models.common.SearchKeywords 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 SetSearchKeywordsChangeBuilder 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.SearchKeywords 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.SearchKeywords 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 SetSearchKeywordsChange with checking for non-null required values 174 * @return SetSearchKeywordsChange 175 */ 176 public SetSearchKeywordsChange build() { 177 Objects.requireNonNull(change, SetSearchKeywordsChange.class + ": change is missing"); 178 Objects.requireNonNull(previousValue, SetSearchKeywordsChange.class + ": previousValue is missing"); 179 Objects.requireNonNull(nextValue, SetSearchKeywordsChange.class + ": nextValue is missing"); 180 Objects.requireNonNull(catalogData, SetSearchKeywordsChange.class + ": catalogData is missing"); 181 return new SetSearchKeywordsChangeImpl(change, previousValue, nextValue, catalogData); 182 } 183 184 /** 185 * builds SetSearchKeywordsChange without checking for non-null required values 186 * @return SetSearchKeywordsChange 187 */ 188 public SetSearchKeywordsChange buildUnchecked() { 189 return new SetSearchKeywordsChangeImpl(change, previousValue, nextValue, catalogData); 190 } 191 192 /** 193 * factory method for an instance of SetSearchKeywordsChangeBuilder 194 * @return builder 195 */ 196 public static SetSearchKeywordsChangeBuilder of() { 197 return new SetSearchKeywordsChangeBuilder(); 198 } 199 200 /** 201 * create builder for SetSearchKeywordsChange instance 202 * @param template instance with prefilled values for the builder 203 * @return builder 204 */ 205 public static SetSearchKeywordsChangeBuilder of(final SetSearchKeywordsChange template) { 206 SetSearchKeywordsChangeBuilder builder = new SetSearchKeywordsChangeBuilder(); 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}