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.constraints.NotNull; 010 011import com.commercetools.history.models.common.ChannelRole; 012import com.fasterxml.jackson.annotation.*; 013import com.fasterxml.jackson.databind.annotation.*; 014 015import io.vrap.rmf.base.client.utils.Generated; 016 017/** 018 * <p>Change triggered by the Add Roles update action.</p> 019 * 020 * <hr> 021 * Example to create an instance using the builder pattern 022 * <div class=code-example> 023 * <pre><code class='java'> 024 * AddChannelRolesChange addChannelRolesChange = AddChannelRolesChange.builder() 025 * .change("{change}") 026 * .plusPreviousValue(previousValueBuilder -> previousValueBuilder) 027 * .plusNextValue(nextValueBuilder -> nextValueBuilder) 028 * .build() 029 * </code></pre> 030 * </div> 031 */ 032@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 033@JsonDeserialize(as = AddChannelRolesChangeImpl.class) 034public interface AddChannelRolesChange extends Change { 035 036 /** 037 * discriminator value for AddChannelRolesChange 038 */ 039 String ADD_CHANNEL_ROLES_CHANGE = "AddChannelRolesChange"; 040 041 /** 042 * 043 * @return type 044 */ 045 @NotNull 046 @JsonProperty("type") 047 public String getType(); 048 049 /** 050 * 051 * @return change 052 */ 053 @NotNull 054 @JsonProperty("change") 055 public String getChange(); 056 057 /** 058 * <p>Value before the change.</p> 059 * @return previousValue 060 */ 061 @NotNull 062 @JsonProperty("previousValue") 063 public List<ChannelRole> getPreviousValue(); 064 065 /** 066 * <p>Value after the change.</p> 067 * @return nextValue 068 */ 069 @NotNull 070 @JsonProperty("nextValue") 071 public List<ChannelRole> getNextValue(); 072 073 /** 074 * set change 075 * @param change value to be set 076 */ 077 078 public void setChange(final String change); 079 080 /** 081 * <p>Value before the change.</p> 082 * @param previousValue values to be set 083 */ 084 085 @JsonIgnore 086 public void setPreviousValue(final ChannelRole... previousValue); 087 088 /** 089 * <p>Value before the change.</p> 090 * @param previousValue values to be set 091 */ 092 093 public void setPreviousValue(final List<ChannelRole> previousValue); 094 095 /** 096 * <p>Value after the change.</p> 097 * @param nextValue values to be set 098 */ 099 100 @JsonIgnore 101 public void setNextValue(final ChannelRole... nextValue); 102 103 /** 104 * <p>Value after the change.</p> 105 * @param nextValue values to be set 106 */ 107 108 public void setNextValue(final List<ChannelRole> nextValue); 109 110 /** 111 * factory method 112 * @return instance of AddChannelRolesChange 113 */ 114 public static AddChannelRolesChange of() { 115 return new AddChannelRolesChangeImpl(); 116 } 117 118 /** 119 * factory method to create a shallow copy AddChannelRolesChange 120 * @param template instance to be copied 121 * @return copy instance 122 */ 123 public static AddChannelRolesChange of(final AddChannelRolesChange template) { 124 AddChannelRolesChangeImpl instance = new AddChannelRolesChangeImpl(); 125 instance.setChange(template.getChange()); 126 instance.setPreviousValue(template.getPreviousValue()); 127 instance.setNextValue(template.getNextValue()); 128 return instance; 129 } 130 131 /** 132 * factory method to create a deep copy of AddChannelRolesChange 133 * @param template instance to be copied 134 * @return copy instance 135 */ 136 @Nullable 137 public static AddChannelRolesChange deepCopy(@Nullable final AddChannelRolesChange template) { 138 if (template == null) { 139 return null; 140 } 141 AddChannelRolesChangeImpl instance = new AddChannelRolesChangeImpl(); 142 instance.setChange(template.getChange()); 143 instance.setPreviousValue(Optional.ofNullable(template.getPreviousValue()).map(ArrayList::new).orElse(null)); 144 instance.setNextValue(Optional.ofNullable(template.getNextValue()).map(ArrayList::new).orElse(null)); 145 return instance; 146 } 147 148 /** 149 * builder factory method for AddChannelRolesChange 150 * @return builder 151 */ 152 public static AddChannelRolesChangeBuilder builder() { 153 return AddChannelRolesChangeBuilder.of(); 154 } 155 156 /** 157 * create builder for AddChannelRolesChange instance 158 * @param template instance with prefilled values for the builder 159 * @return builder 160 */ 161 public static AddChannelRolesChangeBuilder builder(final AddChannelRolesChange template) { 162 return AddChannelRolesChangeBuilder.of(template); 163 } 164 165 /** 166 * accessor map function 167 * @param <T> mapped type 168 * @param helper function to map the object 169 * @return mapped value 170 */ 171 default <T> T withAddChannelRolesChange(Function<AddChannelRolesChange, T> helper) { 172 return helper.apply(this); 173 } 174 175 /** 176 * gives a TypeReference for usage with Jackson DataBind 177 * @return TypeReference 178 */ 179 public static com.fasterxml.jackson.core.type.TypeReference<AddChannelRolesChange> typeReference() { 180 return new com.fasterxml.jackson.core.type.TypeReference<AddChannelRolesChange>() { 181 @Override 182 public String toString() { 183 return "TypeReference<AddChannelRolesChange>"; 184 } 185 }; 186 } 187}