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