001 002package com.commercetools.history.models.change; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007import java.util.stream.Collectors; 008 009import javax.annotation.Nullable; 010import javax.validation.Valid; 011import javax.validation.constraints.NotNull; 012 013import com.commercetools.history.models.common.Reference; 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 Set Transitions 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 * SetTransitionsChange setTransitionsChange = SetTransitionsChange.builder() 027 * .change("{change}") 028 * .plusPreviousValue(previousValueBuilder -> previousValueBuilder) 029 * .plusNextValue(nextValueBuilder -> nextValueBuilder) 030 * .build() 031 * </code></pre> 032 * </div> 033 */ 034@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 035@JsonDeserialize(as = SetTransitionsChangeImpl.class) 036public interface SetTransitionsChange extends Change { 037 038 /** 039 * discriminator value for SetTransitionsChange 040 */ 041 String SET_TRANSITIONS_CHANGE = "SetTransitionsChange"; 042 043 /** 044 * 045 * @return type 046 */ 047 @NotNull 048 @JsonProperty("type") 049 public String getType(); 050 051 /** 052 * 053 * @return change 054 */ 055 @NotNull 056 @JsonProperty("change") 057 public String getChange(); 058 059 /** 060 * <p>Value before the change.</p> 061 * @return previousValue 062 */ 063 @NotNull 064 @Valid 065 @JsonProperty("previousValue") 066 public List<Reference> getPreviousValue(); 067 068 /** 069 * <p>Value after the change.</p> 070 * @return nextValue 071 */ 072 @NotNull 073 @Valid 074 @JsonProperty("nextValue") 075 public List<Reference> getNextValue(); 076 077 /** 078 * set change 079 * @param change value to be set 080 */ 081 082 public void setChange(final String change); 083 084 /** 085 * <p>Value before the change.</p> 086 * @param previousValue values to be set 087 */ 088 089 @JsonIgnore 090 public void setPreviousValue(final Reference... previousValue); 091 092 /** 093 * <p>Value before the change.</p> 094 * @param previousValue values to be set 095 */ 096 097 public void setPreviousValue(final List<Reference> previousValue); 098 099 /** 100 * <p>Value after the change.</p> 101 * @param nextValue values to be set 102 */ 103 104 @JsonIgnore 105 public void setNextValue(final Reference... nextValue); 106 107 /** 108 * <p>Value after the change.</p> 109 * @param nextValue values to be set 110 */ 111 112 public void setNextValue(final List<Reference> nextValue); 113 114 /** 115 * factory method 116 * @return instance of SetTransitionsChange 117 */ 118 public static SetTransitionsChange of() { 119 return new SetTransitionsChangeImpl(); 120 } 121 122 /** 123 * factory method to create a shallow copy SetTransitionsChange 124 * @param template instance to be copied 125 * @return copy instance 126 */ 127 public static SetTransitionsChange of(final SetTransitionsChange template) { 128 SetTransitionsChangeImpl instance = new SetTransitionsChangeImpl(); 129 instance.setChange(template.getChange()); 130 instance.setPreviousValue(template.getPreviousValue()); 131 instance.setNextValue(template.getNextValue()); 132 return instance; 133 } 134 135 /** 136 * factory method to create a deep copy of SetTransitionsChange 137 * @param template instance to be copied 138 * @return copy instance 139 */ 140 @Nullable 141 public static SetTransitionsChange deepCopy(@Nullable final SetTransitionsChange template) { 142 if (template == null) { 143 return null; 144 } 145 SetTransitionsChangeImpl instance = new SetTransitionsChangeImpl(); 146 instance.setChange(template.getChange()); 147 instance.setPreviousValue(Optional.ofNullable(template.getPreviousValue()) 148 .map(t -> t.stream() 149 .map(com.commercetools.history.models.common.Reference::deepCopy) 150 .collect(Collectors.toList())) 151 .orElse(null)); 152 instance.setNextValue(Optional.ofNullable(template.getNextValue()) 153 .map(t -> t.stream() 154 .map(com.commercetools.history.models.common.Reference::deepCopy) 155 .collect(Collectors.toList())) 156 .orElse(null)); 157 return instance; 158 } 159 160 /** 161 * builder factory method for SetTransitionsChange 162 * @return builder 163 */ 164 public static SetTransitionsChangeBuilder builder() { 165 return SetTransitionsChangeBuilder.of(); 166 } 167 168 /** 169 * create builder for SetTransitionsChange instance 170 * @param template instance with prefilled values for the builder 171 * @return builder 172 */ 173 public static SetTransitionsChangeBuilder builder(final SetTransitionsChange template) { 174 return SetTransitionsChangeBuilder.of(template); 175 } 176 177 /** 178 * accessor map function 179 * @param <T> mapped type 180 * @param helper function to map the object 181 * @return mapped value 182 */ 183 default <T> T withSetTransitionsChange(Function<SetTransitionsChange, T> helper) { 184 return helper.apply(this); 185 } 186 187 /** 188 * gives a TypeReference for usage with Jackson DataBind 189 * @return TypeReference 190 */ 191 public static com.fasterxml.jackson.core.type.TypeReference<SetTransitionsChange> typeReference() { 192 return new com.fasterxml.jackson.core.type.TypeReference<SetTransitionsChange>() { 193 @Override 194 public String toString() { 195 return "TypeReference<SetTransitionsChange>"; 196 } 197 }; 198 } 199}