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.LocalizedString; 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 Name on Discount Codes.</li> 022 * <li>Set State Name on States.</li> 023 * <li>Set Name on Stores.</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 * SetNameChange setNameChange = SetNameChange.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 = SetNameChangeImpl.class) 040public interface SetNameChange extends Change { 041 042 /** 043 * discriminator value for SetNameChange 044 */ 045 String SET_NAME_CHANGE = "SetNameChange"; 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 LocalizedString getPreviousValue(); 071 072 /** 073 * <p>Value after the change.</p> 074 * @return nextValue 075 */ 076 @NotNull 077 @Valid 078 @JsonProperty("nextValue") 079 public LocalizedString 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 LocalizedString previousValue); 094 095 /** 096 * <p>Value after the change.</p> 097 * @param nextValue value to be set 098 */ 099 100 public void setNextValue(final LocalizedString nextValue); 101 102 /** 103 * factory method 104 * @return instance of SetNameChange 105 */ 106 public static SetNameChange of() { 107 return new SetNameChangeImpl(); 108 } 109 110 /** 111 * factory method to create a shallow copy SetNameChange 112 * @param template instance to be copied 113 * @return copy instance 114 */ 115 public static SetNameChange of(final SetNameChange template) { 116 SetNameChangeImpl instance = new SetNameChangeImpl(); 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 SetNameChange 125 * @param template instance to be copied 126 * @return copy instance 127 */ 128 @Nullable 129 public static SetNameChange deepCopy(@Nullable final SetNameChange template) { 130 if (template == null) { 131 return null; 132 } 133 SetNameChangeImpl instance = new SetNameChangeImpl(); 134 instance.setChange(template.getChange()); 135 instance.setPreviousValue( 136 com.commercetools.history.models.common.LocalizedString.deepCopy(template.getPreviousValue())); 137 instance.setNextValue( 138 com.commercetools.history.models.common.LocalizedString.deepCopy(template.getNextValue())); 139 return instance; 140 } 141 142 /** 143 * builder factory method for SetNameChange 144 * @return builder 145 */ 146 public static SetNameChangeBuilder builder() { 147 return SetNameChangeBuilder.of(); 148 } 149 150 /** 151 * create builder for SetNameChange instance 152 * @param template instance with prefilled values for the builder 153 * @return builder 154 */ 155 public static SetNameChangeBuilder builder(final SetNameChange template) { 156 return SetNameChangeBuilder.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 withSetNameChange(Function<SetNameChange, 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<SetNameChange> typeReference() { 174 return new com.fasterxml.jackson.core.type.TypeReference<SetNameChange>() { 175 @Override 176 public String toString() { 177 return "TypeReference<SetNameChange>"; 178 } 179 }; 180 } 181}