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.ValidFromAndUntilValue; 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 Valid From and Until on Cart Discounts.</li> 022 * <li>Set Valid From and Until on Discount Codes.</li> 023 * <li>Set Valid From and Until on Product Discounts.</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 * SetValidFromAndUntilChange setValidFromAndUntilChange = SetValidFromAndUntilChange.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 = SetValidFromAndUntilChangeImpl.class) 040public interface SetValidFromAndUntilChange extends Change { 041 042 /** 043 * discriminator value for SetValidFromAndUntilChange 044 */ 045 String SET_VALID_FROM_AND_UNTIL_CHANGE = "SetValidFromAndUntilChange"; 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 ValidFromAndUntilValue getPreviousValue(); 071 072 /** 073 * <p>Value after the change.</p> 074 * @return nextValue 075 */ 076 @NotNull 077 @Valid 078 @JsonProperty("nextValue") 079 public ValidFromAndUntilValue 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 ValidFromAndUntilValue previousValue); 094 095 /** 096 * <p>Value after the change.</p> 097 * @param nextValue value to be set 098 */ 099 100 public void setNextValue(final ValidFromAndUntilValue nextValue); 101 102 /** 103 * factory method 104 * @return instance of SetValidFromAndUntilChange 105 */ 106 public static SetValidFromAndUntilChange of() { 107 return new SetValidFromAndUntilChangeImpl(); 108 } 109 110 /** 111 * factory method to create a shallow copy SetValidFromAndUntilChange 112 * @param template instance to be copied 113 * @return copy instance 114 */ 115 public static SetValidFromAndUntilChange of(final SetValidFromAndUntilChange template) { 116 SetValidFromAndUntilChangeImpl instance = new SetValidFromAndUntilChangeImpl(); 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 SetValidFromAndUntilChange 125 * @param template instance to be copied 126 * @return copy instance 127 */ 128 @Nullable 129 public static SetValidFromAndUntilChange deepCopy(@Nullable final SetValidFromAndUntilChange template) { 130 if (template == null) { 131 return null; 132 } 133 SetValidFromAndUntilChangeImpl instance = new SetValidFromAndUntilChangeImpl(); 134 instance.setChange(template.getChange()); 135 instance.setPreviousValue( 136 com.commercetools.history.models.change_value.ValidFromAndUntilValue.deepCopy(template.getPreviousValue())); 137 instance.setNextValue( 138 com.commercetools.history.models.change_value.ValidFromAndUntilValue.deepCopy(template.getNextValue())); 139 return instance; 140 } 141 142 /** 143 * builder factory method for SetValidFromAndUntilChange 144 * @return builder 145 */ 146 public static SetValidFromAndUntilChangeBuilder builder() { 147 return SetValidFromAndUntilChangeBuilder.of(); 148 } 149 150 /** 151 * create builder for SetValidFromAndUntilChange instance 152 * @param template instance with prefilled values for the builder 153 * @return builder 154 */ 155 public static SetValidFromAndUntilChangeBuilder builder(final SetValidFromAndUntilChange template) { 156 return SetValidFromAndUntilChangeBuilder.of(template); 157 } 158 159 /** 160 * accessor map function 161 * @param <T> mapped type 162 * @param helper function to map the object 163 * @return mapped value 164 */ 165 default <T> T withSetValidFromAndUntilChange(Function<SetValidFromAndUntilChange, T> helper) { 166 return helper.apply(this); 167 } 168 169 /** 170 * gives a TypeReference for usage with Jackson DataBind 171 * @return TypeReference 172 */ 173 public static com.fasterxml.jackson.core.type.TypeReference<SetValidFromAndUntilChange> typeReference() { 174 return new com.fasterxml.jackson.core.type.TypeReference<SetValidFromAndUntilChange>() { 175 @Override 176 public String toString() { 177 return "TypeReference<SetValidFromAndUntilChange>"; 178 } 179 }; 180 } 181}