001
002package com.commercetools.history.models.change;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009import javax.validation.Valid;
010import javax.validation.constraints.NotNull;
011
012import com.commercetools.history.models.change_value.AssetChangeValue;
013import com.fasterxml.jackson.annotation.*;
014import com.fasterxml.jackson.databind.annotation.*;
015
016import io.vrap.rmf.base.client.utils.Generated;
017
018/**
019 *  <p>Change triggered by the following update actions:</p>
020 *  <ul>
021 *   <li>Set Asset CustomField on Categories.</li>
022 *   <li>Set Asset CustomField on Products.</li>
023 *  </ul>
024 *
025 * <hr>
026 * Example to create an instance using the builder pattern
027 * <div class=code-example>
028 * <pre><code class='java'>
029 *     SetAssetCustomFieldChange setAssetCustomFieldChange = SetAssetCustomFieldChange.builder()
030 *             .change("{change}")
031 *             .name("{name}")
032 *             .customTypeId("{customTypeId}")
033 *             .asset(assetBuilder -> assetBuilder)
034 *             .build()
035 * </code></pre>
036 * </div>
037 */
038@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
039@JsonDeserialize(as = SetAssetCustomFieldChangeImpl.class)
040public interface SetAssetCustomFieldChange extends Change {
041
042    /**
043     * discriminator value for SetAssetCustomFieldChange
044     */
045    String SET_ASSET_CUSTOM_FIELD_CHANGE = "SetAssetCustomFieldChange";
046
047    /**
048     *
049     * @return change
050     */
051    @NotNull
052    @JsonProperty("change")
053    public String getChange();
054
055    /**
056     *
057     * @return type
058     */
059    @NotNull
060    @JsonProperty("type")
061    public String getType();
062
063    /**
064     *  <p>Value before the change.</p>
065     * @return previousValue
066     */
067    @NotNull
068    @JsonProperty("previousValue")
069    public Object getPreviousValue();
070
071    /**
072     *  <p>Value after the change.</p>
073     * @return nextValue
074     */
075    @NotNull
076    @JsonProperty("nextValue")
077    public Object getNextValue();
078
079    /**
080     *  <p>Name of the Custom Field.</p>
081     * @return name
082     */
083    @NotNull
084    @JsonProperty("name")
085    public String getName();
086
087    /**
088     *  <p><code>id</code> of the referenced Type.</p>
089     * @return customTypeId
090     */
091    @NotNull
092    @JsonProperty("customTypeId")
093    public String getCustomTypeId();
094
095    /**
096     *  <p>Information about the updated Asset.</p>
097     * @return asset
098     */
099    @NotNull
100    @Valid
101    @JsonProperty("asset")
102    public AssetChangeValue getAsset();
103
104    /**
105     * set change
106     * @param change value to be set
107     */
108
109    public void setChange(final String change);
110
111    /**
112     *  <p>Value before the change.</p>
113     * @param previousValue value to be set
114     */
115
116    public void setPreviousValue(final Object previousValue);
117
118    /**
119     *  <p>Value after the change.</p>
120     * @param nextValue value to be set
121     */
122
123    public void setNextValue(final Object nextValue);
124
125    /**
126     *  <p>Name of the Custom Field.</p>
127     * @param name value to be set
128     */
129
130    public void setName(final String name);
131
132    /**
133     *  <p><code>id</code> of the referenced Type.</p>
134     * @param customTypeId value to be set
135     */
136
137    public void setCustomTypeId(final String customTypeId);
138
139    /**
140     *  <p>Information about the updated Asset.</p>
141     * @param asset value to be set
142     */
143
144    public void setAsset(final AssetChangeValue asset);
145
146    /**
147     * factory method
148     * @return instance of SetAssetCustomFieldChange
149     */
150    public static SetAssetCustomFieldChange of() {
151        return new SetAssetCustomFieldChangeImpl();
152    }
153
154    /**
155     * factory method to create a shallow copy SetAssetCustomFieldChange
156     * @param template instance to be copied
157     * @return copy instance
158     */
159    public static SetAssetCustomFieldChange of(final SetAssetCustomFieldChange template) {
160        SetAssetCustomFieldChangeImpl instance = new SetAssetCustomFieldChangeImpl();
161        instance.setChange(template.getChange());
162        instance.setPreviousValue(template.getPreviousValue());
163        instance.setNextValue(template.getNextValue());
164        instance.setName(template.getName());
165        instance.setCustomTypeId(template.getCustomTypeId());
166        instance.setAsset(template.getAsset());
167        return instance;
168    }
169
170    /**
171     * factory method to create a deep copy of SetAssetCustomFieldChange
172     * @param template instance to be copied
173     * @return copy instance
174     */
175    @Nullable
176    public static SetAssetCustomFieldChange deepCopy(@Nullable final SetAssetCustomFieldChange template) {
177        if (template == null) {
178            return null;
179        }
180        SetAssetCustomFieldChangeImpl instance = new SetAssetCustomFieldChangeImpl();
181        instance.setChange(template.getChange());
182        instance.setPreviousValue(template.getPreviousValue());
183        instance.setNextValue(template.getNextValue());
184        instance.setName(template.getName());
185        instance.setCustomTypeId(template.getCustomTypeId());
186        instance.setAsset(com.commercetools.history.models.change_value.AssetChangeValue.deepCopy(template.getAsset()));
187        return instance;
188    }
189
190    /**
191     * builder factory method for SetAssetCustomFieldChange
192     * @return builder
193     */
194    public static SetAssetCustomFieldChangeBuilder builder() {
195        return SetAssetCustomFieldChangeBuilder.of();
196    }
197
198    /**
199     * create builder for SetAssetCustomFieldChange instance
200     * @param template instance with prefilled values for the builder
201     * @return builder
202     */
203    public static SetAssetCustomFieldChangeBuilder builder(final SetAssetCustomFieldChange template) {
204        return SetAssetCustomFieldChangeBuilder.of(template);
205    }
206
207    /**
208     * accessor map function
209     * @param <T> mapped type
210     * @param helper function to map the object
211     * @return mapped value
212     */
213    default <T> T withSetAssetCustomFieldChange(Function<SetAssetCustomFieldChange, T> helper) {
214        return helper.apply(this);
215    }
216
217    /**
218     * gives a TypeReference for usage with Jackson DataBind
219     * @return TypeReference
220     */
221    public static com.fasterxml.jackson.core.type.TypeReference<SetAssetCustomFieldChange> typeReference() {
222        return new com.fasterxml.jackson.core.type.TypeReference<SetAssetCustomFieldChange>() {
223            @Override
224            public String toString() {
225                return "TypeReference<SetAssetCustomFieldChange>";
226            }
227        };
228    }
229}