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 contains a key that already exists.</p> 018 * 019 * <hr> 020 * Example to create an instance using the builder pattern 021 * <div class=code-example> 022 * <pre><code class='java'> 023 * EnumKeyAlreadyExistsError enumKeyAlreadyExistsError = EnumKeyAlreadyExistsError.builder() 024 * .message("{message}") 025 * .conflictingEnumKey("{conflictingEnumKey}") 026 * .conflictingAttributeName("{conflictingAttributeName}") 027 * .build() 028 * </code></pre> 029 * </div> 030 */ 031@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 032@JsonDeserialize(as = EnumKeyAlreadyExistsErrorImpl.class) 033public interface EnumKeyAlreadyExistsError extends ErrorObject { 034 035 /** 036 * discriminator value for EnumKeyAlreadyExistsError 037 */ 038 String ENUM_KEY_ALREADY_EXISTS = "EnumKeyAlreadyExists"; 039 040 /** 041 * 042 * @return code 043 */ 044 @NotNull 045 @JsonProperty("code") 046 public String getCode(); 047 048 /** 049 * <p><code>"The $attributeName attribute definition already contains an enum value with the key $enumKey."</code></p> 050 * @return message 051 */ 052 @NotNull 053 @JsonProperty("message") 054 public String getMessage(); 055 056 /** 057 * <p>Conflicting enum key.</p> 058 * @return conflictingEnumKey 059 */ 060 @NotNull 061 @JsonProperty("conflictingEnumKey") 062 public String getConflictingEnumKey(); 063 064 /** 065 * <p>Name of the conflicting Attribute.</p> 066 * @return conflictingAttributeName 067 */ 068 @NotNull 069 @JsonProperty("conflictingAttributeName") 070 public String getConflictingAttributeName(); 071 072 /** 073 * <p><code>"The $attributeName attribute definition already contains an enum value with the key $enumKey."</code></p> 074 * @param message value to be set 075 */ 076 077 public void setMessage(final String message); 078 079 /** 080 * <p>Conflicting enum key.</p> 081 * @param conflictingEnumKey value to be set 082 */ 083 084 public void setConflictingEnumKey(final String conflictingEnumKey); 085 086 /** 087 * <p>Name of the conflicting Attribute.</p> 088 * @param conflictingAttributeName value to be set 089 */ 090 091 public void setConflictingAttributeName(final String conflictingAttributeName); 092 093 /** 094 * factory method 095 * @return instance of EnumKeyAlreadyExistsError 096 */ 097 public static EnumKeyAlreadyExistsError of() { 098 return new EnumKeyAlreadyExistsErrorImpl(); 099 } 100 101 /** 102 * factory method to create a shallow copy EnumKeyAlreadyExistsError 103 * @param template instance to be copied 104 * @return copy instance 105 */ 106 public static EnumKeyAlreadyExistsError of(final EnumKeyAlreadyExistsError template) { 107 EnumKeyAlreadyExistsErrorImpl instance = new EnumKeyAlreadyExistsErrorImpl(); 108 instance.setMessage(template.getMessage()); 109 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 110 instance.setConflictingEnumKey(template.getConflictingEnumKey()); 111 instance.setConflictingAttributeName(template.getConflictingAttributeName()); 112 return instance; 113 } 114 115 /** 116 * factory method to create a deep copy of EnumKeyAlreadyExistsError 117 * @param template instance to be copied 118 * @return copy instance 119 */ 120 @Nullable 121 public static EnumKeyAlreadyExistsError deepCopy(@Nullable final EnumKeyAlreadyExistsError template) { 122 if (template == null) { 123 return null; 124 } 125 EnumKeyAlreadyExistsErrorImpl instance = new EnumKeyAlreadyExistsErrorImpl(); 126 instance.setMessage(template.getMessage()); 127 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 128 instance.setConflictingEnumKey(template.getConflictingEnumKey()); 129 instance.setConflictingAttributeName(template.getConflictingAttributeName()); 130 return instance; 131 } 132 133 /** 134 * builder factory method for EnumKeyAlreadyExistsError 135 * @return builder 136 */ 137 public static EnumKeyAlreadyExistsErrorBuilder builder() { 138 return EnumKeyAlreadyExistsErrorBuilder.of(); 139 } 140 141 /** 142 * create builder for EnumKeyAlreadyExistsError instance 143 * @param template instance with prefilled values for the builder 144 * @return builder 145 */ 146 public static EnumKeyAlreadyExistsErrorBuilder builder(final EnumKeyAlreadyExistsError template) { 147 return EnumKeyAlreadyExistsErrorBuilder.of(template); 148 } 149 150 /** 151 * accessor map function 152 * @param <T> mapped type 153 * @param helper function to map the object 154 * @return mapped value 155 */ 156 default <T> T withEnumKeyAlreadyExistsError(Function<EnumKeyAlreadyExistsError, T> helper) { 157 return helper.apply(this); 158 } 159 160 /** 161 * gives a TypeReference for usage with Jackson DataBind 162 * @return TypeReference 163 */ 164 public static com.fasterxml.jackson.core.type.TypeReference<EnumKeyAlreadyExistsError> typeReference() { 165 return new com.fasterxml.jackson.core.type.TypeReference<EnumKeyAlreadyExistsError>() { 166 @Override 167 public String toString() { 168 return "TypeReference<EnumKeyAlreadyExistsError>"; 169 } 170 }; 171 } 172}