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.Money; 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 automatically due to a user-initiated change.</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 * SetOrderTotalPriceChange setOrderTotalPriceChange = SetOrderTotalPriceChange.builder() 026 * .change("{change}") 027 * .previousValue(previousValueBuilder -> previousValueBuilder) 028 * .nextValue(nextValueBuilder -> nextValueBuilder) 029 * .build() 030 * </code></pre> 031 * </div> 032 */ 033@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 034@JsonDeserialize(as = SetOrderTotalPriceChangeImpl.class) 035public interface SetOrderTotalPriceChange extends Change { 036 037 /** 038 * discriminator value for SetOrderTotalPriceChange 039 */ 040 String SET_ORDER_TOTAL_PRICE_CHANGE = "SetOrderTotalPriceChange"; 041 042 /** 043 * 044 * @return type 045 */ 046 @NotNull 047 @JsonProperty("type") 048 public String getType(); 049 050 /** 051 * 052 * @return change 053 */ 054 @NotNull 055 @JsonProperty("change") 056 public String getChange(); 057 058 /** 059 * <p>Value before the change.</p> 060 * @return previousValue 061 */ 062 @NotNull 063 @Valid 064 @JsonProperty("previousValue") 065 public Money getPreviousValue(); 066 067 /** 068 * <p>Value after the change.</p> 069 * @return nextValue 070 */ 071 @NotNull 072 @Valid 073 @JsonProperty("nextValue") 074 public Money getNextValue(); 075 076 /** 077 * set change 078 * @param change value to be set 079 */ 080 081 public void setChange(final String change); 082 083 /** 084 * <p>Value before the change.</p> 085 * @param previousValue value to be set 086 */ 087 088 public void setPreviousValue(final Money previousValue); 089 090 /** 091 * <p>Value after the change.</p> 092 * @param nextValue value to be set 093 */ 094 095 public void setNextValue(final Money nextValue); 096 097 /** 098 * factory method 099 * @return instance of SetOrderTotalPriceChange 100 */ 101 public static SetOrderTotalPriceChange of() { 102 return new SetOrderTotalPriceChangeImpl(); 103 } 104 105 /** 106 * factory method to create a shallow copy SetOrderTotalPriceChange 107 * @param template instance to be copied 108 * @return copy instance 109 */ 110 public static SetOrderTotalPriceChange of(final SetOrderTotalPriceChange template) { 111 SetOrderTotalPriceChangeImpl instance = new SetOrderTotalPriceChangeImpl(); 112 instance.setChange(template.getChange()); 113 instance.setPreviousValue(template.getPreviousValue()); 114 instance.setNextValue(template.getNextValue()); 115 return instance; 116 } 117 118 /** 119 * factory method to create a deep copy of SetOrderTotalPriceChange 120 * @param template instance to be copied 121 * @return copy instance 122 */ 123 @Nullable 124 public static SetOrderTotalPriceChange deepCopy(@Nullable final SetOrderTotalPriceChange template) { 125 if (template == null) { 126 return null; 127 } 128 SetOrderTotalPriceChangeImpl instance = new SetOrderTotalPriceChangeImpl(); 129 instance.setChange(template.getChange()); 130 instance.setPreviousValue(com.commercetools.history.models.common.Money.deepCopy(template.getPreviousValue())); 131 instance.setNextValue(com.commercetools.history.models.common.Money.deepCopy(template.getNextValue())); 132 return instance; 133 } 134 135 /** 136 * builder factory method for SetOrderTotalPriceChange 137 * @return builder 138 */ 139 public static SetOrderTotalPriceChangeBuilder builder() { 140 return SetOrderTotalPriceChangeBuilder.of(); 141 } 142 143 /** 144 * create builder for SetOrderTotalPriceChange instance 145 * @param template instance with prefilled values for the builder 146 * @return builder 147 */ 148 public static SetOrderTotalPriceChangeBuilder builder(final SetOrderTotalPriceChange template) { 149 return SetOrderTotalPriceChangeBuilder.of(template); 150 } 151 152 /** 153 * accessor map function 154 * @param <T> mapped type 155 * @param helper function to map the object 156 * @return mapped value 157 */ 158 default <T> T withSetOrderTotalPriceChange(Function<SetOrderTotalPriceChange, T> helper) { 159 return helper.apply(this); 160 } 161 162 /** 163 * gives a TypeReference for usage with Jackson DataBind 164 * @return TypeReference 165 */ 166 public static com.fasterxml.jackson.core.type.TypeReference<SetOrderTotalPriceChange> typeReference() { 167 return new com.fasterxml.jackson.core.type.TypeReference<SetOrderTotalPriceChange>() { 168 @Override 169 public String toString() { 170 return "TypeReference<SetOrderTotalPriceChange>"; 171 } 172 }; 173 } 174}