001 002package com.commercetools.api.models.error; 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.fasterxml.jackson.annotation.*; 012import com.fasterxml.jackson.databind.annotation.*; 013 014import io.vrap.rmf.base.client.utils.Generated; 015 016/** 017 * <p>Returned when an AttributeEnumType or AttributeLocalizedEnumType already contains a value with the given key.</p> 018 * <p>The error is returned as a failed response to the Change the key of an EnumValue 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 * EnumKeyDoesNotExistError enumKeyDoesNotExistError = EnumKeyDoesNotExistError.builder() 025 * .message("{message}") 026 * .conflictingEnumKey("{conflictingEnumKey}") 027 * .conflictingAttributeName("{conflictingAttributeName}") 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 = EnumKeyDoesNotExistErrorImpl.class) 034public interface EnumKeyDoesNotExistError extends ErrorObject { 035 036 /** 037 * discriminator value for EnumKeyDoesNotExistError 038 */ 039 String ENUM_KEY_DOES_NOT_EXIST = "EnumKeyDoesNotExist"; 040 041 /** 042 * 043 * @return code 044 */ 045 @NotNull 046 @JsonProperty("code") 047 public String getCode(); 048 049 /** 050 * <p><code>"The $fieldName field definition does not contain an enum value with the key $enumKey."</code></p> 051 * @return message 052 */ 053 @NotNull 054 @JsonProperty("message") 055 public String getMessage(); 056 057 /** 058 * <p>Conflicting enum key.</p> 059 * @return conflictingEnumKey 060 */ 061 @NotNull 062 @JsonProperty("conflictingEnumKey") 063 public String getConflictingEnumKey(); 064 065 /** 066 * <p>Name of the conflicting Attribute.</p> 067 * @return conflictingAttributeName 068 */ 069 @NotNull 070 @JsonProperty("conflictingAttributeName") 071 public String getConflictingAttributeName(); 072 073 /** 074 * <p><code>"The $fieldName field definition does not contain an enum value with the key $enumKey."</code></p> 075 * @param message value to be set 076 */ 077 078 public void setMessage(final String message); 079 080 /** 081 * <p>Conflicting enum key.</p> 082 * @param conflictingEnumKey value to be set 083 */ 084 085 public void setConflictingEnumKey(final String conflictingEnumKey); 086 087 /** 088 * <p>Name of the conflicting Attribute.</p> 089 * @param conflictingAttributeName value to be set 090 */ 091 092 public void setConflictingAttributeName(final String conflictingAttributeName); 093 094 /** 095 * factory method 096 * @return instance of EnumKeyDoesNotExistError 097 */ 098 public static EnumKeyDoesNotExistError of() { 099 return new EnumKeyDoesNotExistErrorImpl(); 100 } 101 102 /** 103 * factory method to create a shallow copy EnumKeyDoesNotExistError 104 * @param template instance to be copied 105 * @return copy instance 106 */ 107 public static EnumKeyDoesNotExistError of(final EnumKeyDoesNotExistError template) { 108 EnumKeyDoesNotExistErrorImpl instance = new EnumKeyDoesNotExistErrorImpl(); 109 instance.setMessage(template.getMessage()); 110 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 111 instance.setConflictingEnumKey(template.getConflictingEnumKey()); 112 instance.setConflictingAttributeName(template.getConflictingAttributeName()); 113 return instance; 114 } 115 116 /** 117 * factory method to create a deep copy of EnumKeyDoesNotExistError 118 * @param template instance to be copied 119 * @return copy instance 120 */ 121 @Nullable 122 public static EnumKeyDoesNotExistError deepCopy(@Nullable final EnumKeyDoesNotExistError template) { 123 if (template == null) { 124 return null; 125 } 126 EnumKeyDoesNotExistErrorImpl instance = new EnumKeyDoesNotExistErrorImpl(); 127 instance.setMessage(template.getMessage()); 128 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 129 instance.setConflictingEnumKey(template.getConflictingEnumKey()); 130 instance.setConflictingAttributeName(template.getConflictingAttributeName()); 131 return instance; 132 } 133 134 /** 135 * builder factory method for EnumKeyDoesNotExistError 136 * @return builder 137 */ 138 public static EnumKeyDoesNotExistErrorBuilder builder() { 139 return EnumKeyDoesNotExistErrorBuilder.of(); 140 } 141 142 /** 143 * create builder for EnumKeyDoesNotExistError instance 144 * @param template instance with prefilled values for the builder 145 * @return builder 146 */ 147 public static EnumKeyDoesNotExistErrorBuilder builder(final EnumKeyDoesNotExistError template) { 148 return EnumKeyDoesNotExistErrorBuilder.of(template); 149 } 150 151 /** 152 * accessor map function 153 * @param <T> mapped type 154 * @param helper function to map the object 155 * @return mapped value 156 */ 157 default <T> T withEnumKeyDoesNotExistError(Function<EnumKeyDoesNotExistError, T> helper) { 158 return helper.apply(this); 159 } 160 161 /** 162 * gives a TypeReference for usage with Jackson DataBind 163 * @return TypeReference 164 */ 165 public static com.fasterxml.jackson.core.type.TypeReference<EnumKeyDoesNotExistError> typeReference() { 166 return new com.fasterxml.jackson.core.type.TypeReference<EnumKeyDoesNotExistError>() { 167 @Override 168 public String toString() { 169 return "TypeReference<EnumKeyDoesNotExistError>"; 170 } 171 }; 172 } 173}