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.Reference; 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 Product Selection Active 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 * ChangeProductSelectionActiveChange changeProductSelectionActiveChange = ChangeProductSelectionActiveChange.builder() 026 * .change("{change}") 027 * .productSelection(productSelectionBuilder -> productSelectionBuilder) 028 * .previousValue(true) 029 * .nextValue(true) 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 = ChangeProductSelectionActiveChangeImpl.class) 036public interface ChangeProductSelectionActiveChange extends Change { 037 038 /** 039 * discriminator value for ChangeProductSelectionActiveChange 040 */ 041 String CHANGE_PRODUCT_SELECTION_ACTIVE_CHANGE = "ChangeProductSelectionActiveChange"; 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>Reference to the Product Selection which was changed.</p> 061 * @return productSelection 062 */ 063 @NotNull 064 @Valid 065 @JsonProperty("productSelection") 066 public Reference getProductSelection(); 067 068 /** 069 * <p>Value before the change.</p> 070 * @return previousValue 071 */ 072 @NotNull 073 @JsonProperty("previousValue") 074 public Boolean getPreviousValue(); 075 076 /** 077 * <p>Value after the change.</p> 078 * @return nextValue 079 */ 080 @NotNull 081 @JsonProperty("nextValue") 082 public Boolean getNextValue(); 083 084 /** 085 * set change 086 * @param change value to be set 087 */ 088 089 public void setChange(final String change); 090 091 /** 092 * <p>Reference to the Product Selection which was changed.</p> 093 * @param productSelection value to be set 094 */ 095 096 public void setProductSelection(final Reference productSelection); 097 098 /** 099 * <p>Value before the change.</p> 100 * @param previousValue value to be set 101 */ 102 103 public void setPreviousValue(final Boolean previousValue); 104 105 /** 106 * <p>Value after the change.</p> 107 * @param nextValue value to be set 108 */ 109 110 public void setNextValue(final Boolean nextValue); 111 112 /** 113 * factory method 114 * @return instance of ChangeProductSelectionActiveChange 115 */ 116 public static ChangeProductSelectionActiveChange of() { 117 return new ChangeProductSelectionActiveChangeImpl(); 118 } 119 120 /** 121 * factory method to create a shallow copy ChangeProductSelectionActiveChange 122 * @param template instance to be copied 123 * @return copy instance 124 */ 125 public static ChangeProductSelectionActiveChange of(final ChangeProductSelectionActiveChange template) { 126 ChangeProductSelectionActiveChangeImpl instance = new ChangeProductSelectionActiveChangeImpl(); 127 instance.setChange(template.getChange()); 128 instance.setProductSelection(template.getProductSelection()); 129 instance.setPreviousValue(template.getPreviousValue()); 130 instance.setNextValue(template.getNextValue()); 131 return instance; 132 } 133 134 /** 135 * factory method to create a deep copy of ChangeProductSelectionActiveChange 136 * @param template instance to be copied 137 * @return copy instance 138 */ 139 @Nullable 140 public static ChangeProductSelectionActiveChange deepCopy( 141 @Nullable final ChangeProductSelectionActiveChange template) { 142 if (template == null) { 143 return null; 144 } 145 ChangeProductSelectionActiveChangeImpl instance = new ChangeProductSelectionActiveChangeImpl(); 146 instance.setChange(template.getChange()); 147 instance.setProductSelection( 148 com.commercetools.history.models.common.Reference.deepCopy(template.getProductSelection())); 149 instance.setPreviousValue(template.getPreviousValue()); 150 instance.setNextValue(template.getNextValue()); 151 return instance; 152 } 153 154 /** 155 * builder factory method for ChangeProductSelectionActiveChange 156 * @return builder 157 */ 158 public static ChangeProductSelectionActiveChangeBuilder builder() { 159 return ChangeProductSelectionActiveChangeBuilder.of(); 160 } 161 162 /** 163 * create builder for ChangeProductSelectionActiveChange instance 164 * @param template instance with prefilled values for the builder 165 * @return builder 166 */ 167 public static ChangeProductSelectionActiveChangeBuilder builder(final ChangeProductSelectionActiveChange template) { 168 return ChangeProductSelectionActiveChangeBuilder.of(template); 169 } 170 171 /** 172 * accessor map function 173 * @param <T> mapped type 174 * @param helper function to map the object 175 * @return mapped value 176 */ 177 default <T> T withChangeProductSelectionActiveChange(Function<ChangeProductSelectionActiveChange, T> helper) { 178 return helper.apply(this); 179 } 180 181 /** 182 * gives a TypeReference for usage with Jackson DataBind 183 * @return TypeReference 184 */ 185 public static com.fasterxml.jackson.core.type.TypeReference<ChangeProductSelectionActiveChange> typeReference() { 186 return new com.fasterxml.jackson.core.type.TypeReference<ChangeProductSelectionActiveChange>() { 187 @Override 188 public String toString() { 189 return "TypeReference<ChangeProductSelectionActiveChange>"; 190 } 191 }; 192 } 193}