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