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.Reference; 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 Customer on Payments.</li> 022 * <li>Set Customer on Reviews.</li> 023 * <li>Set Customer on Shopping Lists.</li> 024 * </ul> 025 * 026 * <hr> 027 * Example to create an instance using the builder pattern 028 * <div class=code-example> 029 * <pre><code class='java'> 030 * SetCustomerChange setCustomerChange = SetCustomerChange.builder() 031 * .change("{change}") 032 * .previousValue(previousValueBuilder -> previousValueBuilder) 033 * .nextValue(nextValueBuilder -> nextValueBuilder) 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 = SetCustomerChangeImpl.class) 040public interface SetCustomerChange extends Change { 041 042 /** 043 * discriminator value for SetCustomerChange 044 */ 045 String SET_CUSTOMER_CHANGE = "SetCustomerChange"; 046 047 /** 048 * 049 * @return type 050 */ 051 @NotNull 052 @JsonProperty("type") 053 public String getType(); 054 055 /** 056 * 057 * @return change 058 */ 059 @NotNull 060 @JsonProperty("change") 061 public String getChange(); 062 063 /** 064 * <p>Value before the change.</p> 065 * @return previousValue 066 */ 067 @NotNull 068 @Valid 069 @JsonProperty("previousValue") 070 public Reference getPreviousValue(); 071 072 /** 073 * <p>Value after the change.</p> 074 * @return nextValue 075 */ 076 @NotNull 077 @Valid 078 @JsonProperty("nextValue") 079 public Reference getNextValue(); 080 081 /** 082 * set change 083 * @param change value to be set 084 */ 085 086 public void setChange(final String change); 087 088 /** 089 * <p>Value before the change.</p> 090 * @param previousValue value to be set 091 */ 092 093 public void setPreviousValue(final Reference previousValue); 094 095 /** 096 * <p>Value after the change.</p> 097 * @param nextValue value to be set 098 */ 099 100 public void setNextValue(final Reference nextValue); 101 102 /** 103 * factory method 104 * @return instance of SetCustomerChange 105 */ 106 public static SetCustomerChange of() { 107 return new SetCustomerChangeImpl(); 108 } 109 110 /** 111 * factory method to create a shallow copy SetCustomerChange 112 * @param template instance to be copied 113 * @return copy instance 114 */ 115 public static SetCustomerChange of(final SetCustomerChange template) { 116 SetCustomerChangeImpl instance = new SetCustomerChangeImpl(); 117 instance.setChange(template.getChange()); 118 instance.setPreviousValue(template.getPreviousValue()); 119 instance.setNextValue(template.getNextValue()); 120 return instance; 121 } 122 123 /** 124 * factory method to create a deep copy of SetCustomerChange 125 * @param template instance to be copied 126 * @return copy instance 127 */ 128 @Nullable 129 public static SetCustomerChange deepCopy(@Nullable final SetCustomerChange template) { 130 if (template == null) { 131 return null; 132 } 133 SetCustomerChangeImpl instance = new SetCustomerChangeImpl(); 134 instance.setChange(template.getChange()); 135 instance.setPreviousValue( 136 com.commercetools.history.models.common.Reference.deepCopy(template.getPreviousValue())); 137 instance.setNextValue(com.commercetools.history.models.common.Reference.deepCopy(template.getNextValue())); 138 return instance; 139 } 140 141 /** 142 * builder factory method for SetCustomerChange 143 * @return builder 144 */ 145 public static SetCustomerChangeBuilder builder() { 146 return SetCustomerChangeBuilder.of(); 147 } 148 149 /** 150 * create builder for SetCustomerChange instance 151 * @param template instance with prefilled values for the builder 152 * @return builder 153 */ 154 public static SetCustomerChangeBuilder builder(final SetCustomerChange template) { 155 return SetCustomerChangeBuilder.of(template); 156 } 157 158 /** 159 * accessor map function 160 * @param <T> mapped type 161 * @param helper function to map the object 162 * @return mapped value 163 */ 164 default <T> T withSetCustomerChange(Function<SetCustomerChange, T> helper) { 165 return helper.apply(this); 166 } 167 168 /** 169 * gives a TypeReference for usage with Jackson DataBind 170 * @return TypeReference 171 */ 172 public static com.fasterxml.jackson.core.type.TypeReference<SetCustomerChange> typeReference() { 173 return new com.fasterxml.jackson.core.type.TypeReference<SetCustomerChange>() { 174 @Override 175 public String toString() { 176 return "TypeReference<SetCustomerChange>"; 177 } 178 }; 179 } 180}