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.AttributeConstraintEnum; 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 Change AttributeDefinition AttributeConstraint 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 * ChangeAttributeConstraintChange changeAttributeConstraintChange = ChangeAttributeConstraintChange.builder() 025 * .change("{change}") 026 * .previousValue(AttributeConstraintEnum.NONE) 027 * .nextValue(AttributeConstraintEnum.NONE) 028 * .attributeName("{attributeName}") 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 = ChangeAttributeConstraintChangeImpl.class) 035public interface ChangeAttributeConstraintChange extends Change { 036 037 /** 038 * discriminator value for ChangeAttributeConstraintChange 039 */ 040 String CHANGE_ATTRIBUTE_CONSTRAINT_CHANGE = "ChangeAttributeConstraintChange"; 041 042 /** 043 * 044 * @return type 045 */ 046 @NotNull 047 @JsonProperty("type") 048 public String getType(); 049 050 /** 051 * 052 * @return change 053 */ 054 @NotNull 055 @JsonProperty("change") 056 public String getChange(); 057 058 /** 059 * <p>Value before the change.</p> 060 * @return previousValue 061 */ 062 @NotNull 063 @JsonProperty("previousValue") 064 public AttributeConstraintEnum getPreviousValue(); 065 066 /** 067 * <p>Value after the change.</p> 068 * @return nextValue 069 */ 070 @NotNull 071 @JsonProperty("nextValue") 072 public AttributeConstraintEnum getNextValue(); 073 074 /** 075 * <p>Name of the updated AttributeDefinition.</p> 076 * @return attributeName 077 */ 078 @NotNull 079 @JsonProperty("attributeName") 080 public String getAttributeName(); 081 082 /** 083 * set change 084 * @param change value to be set 085 */ 086 087 public void setChange(final String change); 088 089 /** 090 * <p>Value before the change.</p> 091 * @param previousValue value to be set 092 */ 093 094 public void setPreviousValue(final AttributeConstraintEnum previousValue); 095 096 /** 097 * <p>Value after the change.</p> 098 * @param nextValue value to be set 099 */ 100 101 public void setNextValue(final AttributeConstraintEnum nextValue); 102 103 /** 104 * <p>Name of the updated AttributeDefinition.</p> 105 * @param attributeName value to be set 106 */ 107 108 public void setAttributeName(final String attributeName); 109 110 /** 111 * factory method 112 * @return instance of ChangeAttributeConstraintChange 113 */ 114 public static ChangeAttributeConstraintChange of() { 115 return new ChangeAttributeConstraintChangeImpl(); 116 } 117 118 /** 119 * factory method to create a shallow copy ChangeAttributeConstraintChange 120 * @param template instance to be copied 121 * @return copy instance 122 */ 123 public static ChangeAttributeConstraintChange of(final ChangeAttributeConstraintChange template) { 124 ChangeAttributeConstraintChangeImpl instance = new ChangeAttributeConstraintChangeImpl(); 125 instance.setChange(template.getChange()); 126 instance.setPreviousValue(template.getPreviousValue()); 127 instance.setNextValue(template.getNextValue()); 128 instance.setAttributeName(template.getAttributeName()); 129 return instance; 130 } 131 132 /** 133 * factory method to create a deep copy of ChangeAttributeConstraintChange 134 * @param template instance to be copied 135 * @return copy instance 136 */ 137 @Nullable 138 public static ChangeAttributeConstraintChange deepCopy(@Nullable final ChangeAttributeConstraintChange template) { 139 if (template == null) { 140 return null; 141 } 142 ChangeAttributeConstraintChangeImpl instance = new ChangeAttributeConstraintChangeImpl(); 143 instance.setChange(template.getChange()); 144 instance.setPreviousValue(template.getPreviousValue()); 145 instance.setNextValue(template.getNextValue()); 146 instance.setAttributeName(template.getAttributeName()); 147 return instance; 148 } 149 150 /** 151 * builder factory method for ChangeAttributeConstraintChange 152 * @return builder 153 */ 154 public static ChangeAttributeConstraintChangeBuilder builder() { 155 return ChangeAttributeConstraintChangeBuilder.of(); 156 } 157 158 /** 159 * create builder for ChangeAttributeConstraintChange instance 160 * @param template instance with prefilled values for the builder 161 * @return builder 162 */ 163 public static ChangeAttributeConstraintChangeBuilder builder(final ChangeAttributeConstraintChange template) { 164 return ChangeAttributeConstraintChangeBuilder.of(template); 165 } 166 167 /** 168 * accessor map function 169 * @param <T> mapped type 170 * @param helper function to map the object 171 * @return mapped value 172 */ 173 default <T> T withChangeAttributeConstraintChange(Function<ChangeAttributeConstraintChange, T> helper) { 174 return helper.apply(this); 175 } 176 177 /** 178 * gives a TypeReference for usage with Jackson DataBind 179 * @return TypeReference 180 */ 181 public static com.fasterxml.jackson.core.type.TypeReference<ChangeAttributeConstraintChange> typeReference() { 182 return new com.fasterxml.jackson.core.type.TypeReference<ChangeAttributeConstraintChange>() { 183 @Override 184 public String toString() { 185 return "TypeReference<ChangeAttributeConstraintChange>"; 186 } 187 }; 188 } 189}