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.AttributeValue; 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 Set Attribute update action.</p> 020 * 021 * <hr> 022 * Example to create an instance using the builder pattern 023 * <div class=code-example> 024 * <pre><code class='java'> 025 * SetAttributeChange setAttributeChange = SetAttributeChange.builder() 026 * .change("{change}") 027 * .previousValue(previousValueBuilder -> previousValueBuilder) 028 * .nextValue(nextValueBuilder -> nextValueBuilder) 029 * .catalogData("{catalogData}") 030 * .build() 031 * </code></pre> 032 * </div> 033 */ 034@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 035@JsonDeserialize(as = SetAttributeChangeImpl.class) 036public interface SetAttributeChange extends Change { 037 038 /** 039 * discriminator value for SetAttributeChange 040 */ 041 String SET_ATTRIBUTE_CHANGE = "SetAttributeChange"; 042 043 /** 044 * 045 * @return type 046 */ 047 @NotNull 048 @JsonProperty("type") 049 public String getType(); 050 051 /** 052 * 053 * @return change 054 */ 055 @NotNull 056 @JsonProperty("change") 057 public String getChange(); 058 059 /** 060 * <p>Value before the change.</p> 061 * @return previousValue 062 */ 063 @NotNull 064 @Valid 065 @JsonProperty("previousValue") 066 public AttributeValue getPreviousValue(); 067 068 /** 069 * <p>Value after the change.</p> 070 * @return nextValue 071 */ 072 @NotNull 073 @Valid 074 @JsonProperty("nextValue") 075 public AttributeValue getNextValue(); 076 077 /** 078 * <ul> 079 * <li><code>staged</code>, if the staged ProductCatalogData was updated.</li> 080 * <li><code>current</code>, if the current ProductCatalogData was updated.</li> 081 * </ul> 082 * @return catalogData 083 */ 084 @NotNull 085 @JsonProperty("catalogData") 086 public String getCatalogData(); 087 088 /** 089 * set change 090 * @param change value to be set 091 */ 092 093 public void setChange(final String change); 094 095 /** 096 * <p>Value before the change.</p> 097 * @param previousValue value to be set 098 */ 099 100 public void setPreviousValue(final AttributeValue previousValue); 101 102 /** 103 * <p>Value after the change.</p> 104 * @param nextValue value to be set 105 */ 106 107 public void setNextValue(final AttributeValue nextValue); 108 109 /** 110 * <ul> 111 * <li><code>staged</code>, if the staged ProductCatalogData was updated.</li> 112 * <li><code>current</code>, if the current ProductCatalogData was updated.</li> 113 * </ul> 114 * @param catalogData value to be set 115 */ 116 117 public void setCatalogData(final String catalogData); 118 119 /** 120 * factory method 121 * @return instance of SetAttributeChange 122 */ 123 public static SetAttributeChange of() { 124 return new SetAttributeChangeImpl(); 125 } 126 127 /** 128 * factory method to create a shallow copy SetAttributeChange 129 * @param template instance to be copied 130 * @return copy instance 131 */ 132 public static SetAttributeChange of(final SetAttributeChange template) { 133 SetAttributeChangeImpl instance = new SetAttributeChangeImpl(); 134 instance.setChange(template.getChange()); 135 instance.setPreviousValue(template.getPreviousValue()); 136 instance.setNextValue(template.getNextValue()); 137 instance.setCatalogData(template.getCatalogData()); 138 return instance; 139 } 140 141 /** 142 * factory method to create a deep copy of SetAttributeChange 143 * @param template instance to be copied 144 * @return copy instance 145 */ 146 @Nullable 147 public static SetAttributeChange deepCopy(@Nullable final SetAttributeChange template) { 148 if (template == null) { 149 return null; 150 } 151 SetAttributeChangeImpl instance = new SetAttributeChangeImpl(); 152 instance.setChange(template.getChange()); 153 instance.setPreviousValue( 154 com.commercetools.history.models.change_value.AttributeValue.deepCopy(template.getPreviousValue())); 155 instance.setNextValue( 156 com.commercetools.history.models.change_value.AttributeValue.deepCopy(template.getNextValue())); 157 instance.setCatalogData(template.getCatalogData()); 158 return instance; 159 } 160 161 /** 162 * builder factory method for SetAttributeChange 163 * @return builder 164 */ 165 public static SetAttributeChangeBuilder builder() { 166 return SetAttributeChangeBuilder.of(); 167 } 168 169 /** 170 * create builder for SetAttributeChange instance 171 * @param template instance with prefilled values for the builder 172 * @return builder 173 */ 174 public static SetAttributeChangeBuilder builder(final SetAttributeChange template) { 175 return SetAttributeChangeBuilder.of(template); 176 } 177 178 /** 179 * accessor map function 180 * @param <T> mapped type 181 * @param helper function to map the object 182 * @return mapped value 183 */ 184 default <T> T withSetAttributeChange(Function<SetAttributeChange, T> helper) { 185 return helper.apply(this); 186 } 187 188 /** 189 * gives a TypeReference for usage with Jackson DataBind 190 * @return TypeReference 191 */ 192 public static com.fasterxml.jackson.core.type.TypeReference<SetAttributeChange> typeReference() { 193 return new com.fasterxml.jackson.core.type.TypeReference<SetAttributeChange>() { 194 @Override 195 public String toString() { 196 return "TypeReference<SetAttributeChange>"; 197 } 198 }; 199 } 200}