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