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