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.ChangeTargetChangeValue; 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 Change Target update action.</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 * ChangeTargetChange changeTargetChange = ChangeTargetChange.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 = ChangeTargetChangeImpl.class) 035public interface ChangeTargetChange extends Change { 036 037 /** 038 * discriminator value for ChangeTargetChange 039 */ 040 String CHANGE_TARGET_CHANGE = "ChangeTargetChange"; 041 042 /** 043 * 044 * @return change 045 */ 046 @NotNull 047 @JsonProperty("change") 048 public String getChange(); 049 050 /** 051 * 052 * @return type 053 */ 054 @NotNull 055 @JsonProperty("type") 056 public String getType(); 057 058 /** 059 * <p>Value before the change.</p> 060 * @return previousValue 061 */ 062 @NotNull 063 @Valid 064 @JsonProperty("previousValue") 065 public ChangeTargetChangeValue getPreviousValue(); 066 067 /** 068 * <p>Value after the change.</p> 069 * @return nextValue 070 */ 071 @NotNull 072 @Valid 073 @JsonProperty("nextValue") 074 public ChangeTargetChangeValue 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 ChangeTargetChangeValue previousValue); 089 090 /** 091 * <p>Value after the change.</p> 092 * @param nextValue value to be set 093 */ 094 095 public void setNextValue(final ChangeTargetChangeValue nextValue); 096 097 /** 098 * factory method 099 * @return instance of ChangeTargetChange 100 */ 101 public static ChangeTargetChange of() { 102 return new ChangeTargetChangeImpl(); 103 } 104 105 /** 106 * factory method to create a shallow copy ChangeTargetChange 107 * @param template instance to be copied 108 * @return copy instance 109 */ 110 public static ChangeTargetChange of(final ChangeTargetChange template) { 111 ChangeTargetChangeImpl instance = new ChangeTargetChangeImpl(); 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 ChangeTargetChange 120 * @param template instance to be copied 121 * @return copy instance 122 */ 123 @Nullable 124 public static ChangeTargetChange deepCopy(@Nullable final ChangeTargetChange template) { 125 if (template == null) { 126 return null; 127 } 128 ChangeTargetChangeImpl instance = new ChangeTargetChangeImpl(); 129 instance.setChange(template.getChange()); 130 instance.setPreviousValue(com.commercetools.history.models.change_value.ChangeTargetChangeValue 131 .deepCopy(template.getPreviousValue())); 132 instance.setNextValue( 133 com.commercetools.history.models.change_value.ChangeTargetChangeValue.deepCopy(template.getNextValue())); 134 return instance; 135 } 136 137 /** 138 * builder factory method for ChangeTargetChange 139 * @return builder 140 */ 141 public static ChangeTargetChangeBuilder builder() { 142 return ChangeTargetChangeBuilder.of(); 143 } 144 145 /** 146 * create builder for ChangeTargetChange instance 147 * @param template instance with prefilled values for the builder 148 * @return builder 149 */ 150 public static ChangeTargetChangeBuilder builder(final ChangeTargetChange template) { 151 return ChangeTargetChangeBuilder.of(template); 152 } 153 154 /** 155 * accessor map function 156 * @param <T> mapped type 157 * @param helper function to map the object 158 * @return mapped value 159 */ 160 default <T> T withChangeTargetChange(Function<ChangeTargetChange, T> helper) { 161 return helper.apply(this); 162 } 163 164 /** 165 * gives a TypeReference for usage with Jackson DataBind 166 * @return TypeReference 167 */ 168 public static com.fasterxml.jackson.core.type.TypeReference<ChangeTargetChange> typeReference() { 169 return new com.fasterxml.jackson.core.type.TypeReference<ChangeTargetChange>() { 170 @Override 171 public String toString() { 172 return "TypeReference<ChangeTargetChange>"; 173 } 174 }; 175 } 176}