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 * SetAssetCustomTypeChangeBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * SetAssetCustomTypeChange setAssetCustomTypeChange = SetAssetCustomTypeChange.builder() 017 * .change("{change}") 018 * .previousValue(previousValueBuilder -> previousValueBuilder) 019 * .nextValue(nextValueBuilder -> nextValueBuilder) 020 * .asset(assetBuilder -> assetBuilder) 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 SetAssetCustomTypeChangeBuilder implements Builder<SetAssetCustomTypeChange> { 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 com.commercetools.history.models.change_value.AssetChangeValue asset; 035 036 /** 037 * set the value to the change 038 * @param change value to be set 039 * @return Builder 040 */ 041 042 public SetAssetCustomTypeChangeBuilder 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 SetAssetCustomTypeChangeBuilder 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 SetAssetCustomTypeChangeBuilder 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 SetAssetCustomTypeChangeBuilder 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 SetAssetCustomTypeChangeBuilder 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 SetAssetCustomTypeChangeBuilder 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 SetAssetCustomTypeChangeBuilder nextValue( 114 final com.commercetools.history.models.common.CustomFields nextValue) { 115 this.nextValue = nextValue; 116 return this; 117 } 118 119 /** 120 * <p>Information about the updated Asset.</p> 121 * @param builder function to build the asset value 122 * @return Builder 123 */ 124 125 public SetAssetCustomTypeChangeBuilder asset( 126 Function<com.commercetools.history.models.change_value.AssetChangeValueBuilder, com.commercetools.history.models.change_value.AssetChangeValueBuilder> builder) { 127 this.asset = builder.apply(com.commercetools.history.models.change_value.AssetChangeValueBuilder.of()).build(); 128 return this; 129 } 130 131 /** 132 * <p>Information about the updated Asset.</p> 133 * @param builder function to build the asset value 134 * @return Builder 135 */ 136 137 public SetAssetCustomTypeChangeBuilder withAsset( 138 Function<com.commercetools.history.models.change_value.AssetChangeValueBuilder, com.commercetools.history.models.change_value.AssetChangeValue> builder) { 139 this.asset = builder.apply(com.commercetools.history.models.change_value.AssetChangeValueBuilder.of()); 140 return this; 141 } 142 143 /** 144 * <p>Information about the updated Asset.</p> 145 * @param asset value to be set 146 * @return Builder 147 */ 148 149 public SetAssetCustomTypeChangeBuilder asset( 150 final com.commercetools.history.models.change_value.AssetChangeValue asset) { 151 this.asset = asset; 152 return this; 153 } 154 155 /** 156 * value of change} 157 * @return change 158 */ 159 160 public String getChange() { 161 return this.change; 162 } 163 164 /** 165 * <p>Value before the change.</p> 166 * @return previousValue 167 */ 168 169 public com.commercetools.history.models.common.CustomFields getPreviousValue() { 170 return this.previousValue; 171 } 172 173 /** 174 * <p>Value after the change.</p> 175 * @return nextValue 176 */ 177 178 public com.commercetools.history.models.common.CustomFields getNextValue() { 179 return this.nextValue; 180 } 181 182 /** 183 * <p>Information about the updated Asset.</p> 184 * @return asset 185 */ 186 187 public com.commercetools.history.models.change_value.AssetChangeValue getAsset() { 188 return this.asset; 189 } 190 191 /** 192 * builds SetAssetCustomTypeChange with checking for non-null required values 193 * @return SetAssetCustomTypeChange 194 */ 195 public SetAssetCustomTypeChange build() { 196 Objects.requireNonNull(change, SetAssetCustomTypeChange.class + ": change is missing"); 197 Objects.requireNonNull(previousValue, SetAssetCustomTypeChange.class + ": previousValue is missing"); 198 Objects.requireNonNull(nextValue, SetAssetCustomTypeChange.class + ": nextValue is missing"); 199 Objects.requireNonNull(asset, SetAssetCustomTypeChange.class + ": asset is missing"); 200 return new SetAssetCustomTypeChangeImpl(change, previousValue, nextValue, asset); 201 } 202 203 /** 204 * builds SetAssetCustomTypeChange without checking for non-null required values 205 * @return SetAssetCustomTypeChange 206 */ 207 public SetAssetCustomTypeChange buildUnchecked() { 208 return new SetAssetCustomTypeChangeImpl(change, previousValue, nextValue, asset); 209 } 210 211 /** 212 * factory method for an instance of SetAssetCustomTypeChangeBuilder 213 * @return builder 214 */ 215 public static SetAssetCustomTypeChangeBuilder of() { 216 return new SetAssetCustomTypeChangeBuilder(); 217 } 218 219 /** 220 * create builder for SetAssetCustomTypeChange instance 221 * @param template instance with prefilled values for the builder 222 * @return builder 223 */ 224 public static SetAssetCustomTypeChangeBuilder of(final SetAssetCustomTypeChange template) { 225 SetAssetCustomTypeChangeBuilder builder = new SetAssetCustomTypeChangeBuilder(); 226 builder.change = template.getChange(); 227 builder.previousValue = template.getPreviousValue(); 228 builder.nextValue = template.getNextValue(); 229 builder.asset = template.getAsset(); 230 return builder; 231 } 232 233}