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 * GraphQLEnumKeyAlreadyExistsError graphQLEnumKeyAlreadyExistsError = GraphQLEnumKeyAlreadyExistsError.builder() 024 * .conflictingEnumKey("{conflictingEnumKey}") 025 * .conflictingAttributeName("{conflictingAttributeName}") 026 * .build() 027 * </code></pre> 028 * </div> 029 */ 030@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 031@JsonDeserialize(as = GraphQLEnumKeyAlreadyExistsErrorImpl.class) 032public interface GraphQLEnumKeyAlreadyExistsError extends GraphQLErrorObject { 033 034 /** 035 * discriminator value for GraphQLEnumKeyAlreadyExistsError 036 */ 037 String ENUM_KEY_ALREADY_EXISTS = "EnumKeyAlreadyExists"; 038 039 /** 040 * 041 * @return code 042 */ 043 @NotNull 044 @JsonProperty("code") 045 public String getCode(); 046 047 /** 048 * <p>Conflicting enum key.</p> 049 * @return conflictingEnumKey 050 */ 051 @NotNull 052 @JsonProperty("conflictingEnumKey") 053 public String getConflictingEnumKey(); 054 055 /** 056 * <p>Name of the conflicting Attribute.</p> 057 * @return conflictingAttributeName 058 */ 059 @NotNull 060 @JsonProperty("conflictingAttributeName") 061 public String getConflictingAttributeName(); 062 063 /** 064 * <p>Conflicting enum key.</p> 065 * @param conflictingEnumKey value to be set 066 */ 067 068 public void setConflictingEnumKey(final String conflictingEnumKey); 069 070 /** 071 * <p>Name of the conflicting Attribute.</p> 072 * @param conflictingAttributeName value to be set 073 */ 074 075 public void setConflictingAttributeName(final String conflictingAttributeName); 076 077 /** 078 * factory method 079 * @return instance of GraphQLEnumKeyAlreadyExistsError 080 */ 081 public static GraphQLEnumKeyAlreadyExistsError of() { 082 return new GraphQLEnumKeyAlreadyExistsErrorImpl(); 083 } 084 085 /** 086 * factory method to create a shallow copy GraphQLEnumKeyAlreadyExistsError 087 * @param template instance to be copied 088 * @return copy instance 089 */ 090 public static GraphQLEnumKeyAlreadyExistsError of(final GraphQLEnumKeyAlreadyExistsError template) { 091 GraphQLEnumKeyAlreadyExistsErrorImpl instance = new GraphQLEnumKeyAlreadyExistsErrorImpl(); 092 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 093 instance.setConflictingEnumKey(template.getConflictingEnumKey()); 094 instance.setConflictingAttributeName(template.getConflictingAttributeName()); 095 return instance; 096 } 097 098 /** 099 * factory method to create a deep copy of GraphQLEnumKeyAlreadyExistsError 100 * @param template instance to be copied 101 * @return copy instance 102 */ 103 @Nullable 104 public static GraphQLEnumKeyAlreadyExistsError deepCopy(@Nullable final GraphQLEnumKeyAlreadyExistsError template) { 105 if (template == null) { 106 return null; 107 } 108 GraphQLEnumKeyAlreadyExistsErrorImpl instance = new GraphQLEnumKeyAlreadyExistsErrorImpl(); 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 * builder factory method for GraphQLEnumKeyAlreadyExistsError 117 * @return builder 118 */ 119 public static GraphQLEnumKeyAlreadyExistsErrorBuilder builder() { 120 return GraphQLEnumKeyAlreadyExistsErrorBuilder.of(); 121 } 122 123 /** 124 * create builder for GraphQLEnumKeyAlreadyExistsError instance 125 * @param template instance with prefilled values for the builder 126 * @return builder 127 */ 128 public static GraphQLEnumKeyAlreadyExistsErrorBuilder builder(final GraphQLEnumKeyAlreadyExistsError template) { 129 return GraphQLEnumKeyAlreadyExistsErrorBuilder.of(template); 130 } 131 132 /** 133 * accessor map function 134 * @param <T> mapped type 135 * @param helper function to map the object 136 * @return mapped value 137 */ 138 default <T> T withGraphQLEnumKeyAlreadyExistsError(Function<GraphQLEnumKeyAlreadyExistsError, T> helper) { 139 return helper.apply(this); 140 } 141 142 /** 143 * gives a TypeReference for usage with Jackson DataBind 144 * @return TypeReference 145 */ 146 public static com.fasterxml.jackson.core.type.TypeReference<GraphQLEnumKeyAlreadyExistsError> typeReference() { 147 return new com.fasterxml.jackson.core.type.TypeReference<GraphQLEnumKeyAlreadyExistsError>() { 148 @Override 149 public String toString() { 150 return "TypeReference<GraphQLEnumKeyAlreadyExistsError>"; 151 } 152 }; 153 } 154}