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.ParcelChangeValue; 013import com.commercetools.history.models.common.ParcelMeasurements; 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 following update actions:</p> 021 * <ul> 022 * <li>SetParcelMeasurements on Orders.</li> 023 * <li>SetParcelMeasurements on Staged Orders.</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 * SetParcelMeasurementsChange setParcelMeasurementsChange = SetParcelMeasurementsChange.builder() 031 * .change("{change}") 032 * .previousValue(previousValueBuilder -> previousValueBuilder) 033 * .nextValue(nextValueBuilder -> nextValueBuilder) 034 * .parcel(parcelBuilder -> parcelBuilder) 035 * .build() 036 * </code></pre> 037 * </div> 038 */ 039@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 040@JsonDeserialize(as = SetParcelMeasurementsChangeImpl.class) 041public interface SetParcelMeasurementsChange extends Change { 042 043 /** 044 * discriminator value for SetParcelMeasurementsChange 045 */ 046 String SET_PARCEL_MEASUREMENTS_CHANGE = "SetParcelMeasurementsChange"; 047 048 /** 049 * 050 * @return type 051 */ 052 @NotNull 053 @JsonProperty("type") 054 public String getType(); 055 056 /** 057 * 058 * @return change 059 */ 060 @NotNull 061 @JsonProperty("change") 062 public String getChange(); 063 064 /** 065 * <p>Value before the change.</p> 066 * @return previousValue 067 */ 068 @NotNull 069 @Valid 070 @JsonProperty("previousValue") 071 public ParcelMeasurements getPreviousValue(); 072 073 /** 074 * <p>Value after the change.</p> 075 * @return nextValue 076 */ 077 @NotNull 078 @Valid 079 @JsonProperty("nextValue") 080 public ParcelMeasurements getNextValue(); 081 082 /** 083 * <p>Information about the updated Parcel.</p> 084 * @return parcel 085 */ 086 @NotNull 087 @Valid 088 @JsonProperty("parcel") 089 public ParcelChangeValue getParcel(); 090 091 /** 092 * set change 093 * @param change value to be set 094 */ 095 096 public void setChange(final String change); 097 098 /** 099 * <p>Value before the change.</p> 100 * @param previousValue value to be set 101 */ 102 103 public void setPreviousValue(final ParcelMeasurements previousValue); 104 105 /** 106 * <p>Value after the change.</p> 107 * @param nextValue value to be set 108 */ 109 110 public void setNextValue(final ParcelMeasurements nextValue); 111 112 /** 113 * <p>Information about the updated Parcel.</p> 114 * @param parcel value to be set 115 */ 116 117 public void setParcel(final ParcelChangeValue parcel); 118 119 /** 120 * factory method 121 * @return instance of SetParcelMeasurementsChange 122 */ 123 public static SetParcelMeasurementsChange of() { 124 return new SetParcelMeasurementsChangeImpl(); 125 } 126 127 /** 128 * factory method to create a shallow copy SetParcelMeasurementsChange 129 * @param template instance to be copied 130 * @return copy instance 131 */ 132 public static SetParcelMeasurementsChange of(final SetParcelMeasurementsChange template) { 133 SetParcelMeasurementsChangeImpl instance = new SetParcelMeasurementsChangeImpl(); 134 instance.setChange(template.getChange()); 135 instance.setPreviousValue(template.getPreviousValue()); 136 instance.setNextValue(template.getNextValue()); 137 instance.setParcel(template.getParcel()); 138 return instance; 139 } 140 141 /** 142 * factory method to create a deep copy of SetParcelMeasurementsChange 143 * @param template instance to be copied 144 * @return copy instance 145 */ 146 @Nullable 147 public static SetParcelMeasurementsChange deepCopy(@Nullable final SetParcelMeasurementsChange template) { 148 if (template == null) { 149 return null; 150 } 151 SetParcelMeasurementsChangeImpl instance = new SetParcelMeasurementsChangeImpl(); 152 instance.setChange(template.getChange()); 153 instance.setPreviousValue( 154 com.commercetools.history.models.common.ParcelMeasurements.deepCopy(template.getPreviousValue())); 155 instance.setNextValue( 156 com.commercetools.history.models.common.ParcelMeasurements.deepCopy(template.getNextValue())); 157 instance.setParcel( 158 com.commercetools.history.models.change_value.ParcelChangeValue.deepCopy(template.getParcel())); 159 return instance; 160 } 161 162 /** 163 * builder factory method for SetParcelMeasurementsChange 164 * @return builder 165 */ 166 public static SetParcelMeasurementsChangeBuilder builder() { 167 return SetParcelMeasurementsChangeBuilder.of(); 168 } 169 170 /** 171 * create builder for SetParcelMeasurementsChange instance 172 * @param template instance with prefilled values for the builder 173 * @return builder 174 */ 175 public static SetParcelMeasurementsChangeBuilder builder(final SetParcelMeasurementsChange template) { 176 return SetParcelMeasurementsChangeBuilder.of(template); 177 } 178 179 /** 180 * accessor map function 181 * @param <T> mapped type 182 * @param helper function to map the object 183 * @return mapped value 184 */ 185 default <T> T withSetParcelMeasurementsChange(Function<SetParcelMeasurementsChange, T> helper) { 186 return helper.apply(this); 187 } 188 189 /** 190 * gives a TypeReference for usage with Jackson DataBind 191 * @return TypeReference 192 */ 193 public static com.fasterxml.jackson.core.type.TypeReference<SetParcelMeasurementsChange> typeReference() { 194 return new com.fasterxml.jackson.core.type.TypeReference<SetParcelMeasurementsChange>() { 195 @Override 196 public String toString() { 197 return "TypeReference<SetParcelMeasurementsChange>"; 198 } 199 }; 200 } 201}