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 the <code>name</code> of the AttributeDefinition conflicts with an existing Attribute.</p> 018 * <p>The error is returned as a failed response to the Create ProductType request or Change AttributeDefinition Name 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 * GraphQLAttributeDefinitionAlreadyExistsError graphQLAttributeDefinitionAlreadyExistsError = GraphQLAttributeDefinitionAlreadyExistsError.builder() 025 * .conflictingProductTypeId("{conflictingProductTypeId}") 026 * .conflictingProductTypeName("{conflictingProductTypeName}") 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 = GraphQLAttributeDefinitionAlreadyExistsErrorImpl.class) 034public interface GraphQLAttributeDefinitionAlreadyExistsError extends GraphQLErrorObject { 035 036 /** 037 * discriminator value for GraphQLAttributeDefinitionAlreadyExistsError 038 */ 039 String ATTRIBUTE_DEFINITION_ALREADY_EXISTS = "AttributeDefinitionAlreadyExists"; 040 041 /** 042 * 043 * @return code 044 */ 045 @NotNull 046 @JsonProperty("code") 047 public String getCode(); 048 049 /** 050 * <p>Unique identifier of the Product Type containing the conflicting name.</p> 051 * @return conflictingProductTypeId 052 */ 053 @NotNull 054 @JsonProperty("conflictingProductTypeId") 055 public String getConflictingProductTypeId(); 056 057 /** 058 * <p>Name of the Product Type containing the conflicting name.</p> 059 * @return conflictingProductTypeName 060 */ 061 @NotNull 062 @JsonProperty("conflictingProductTypeName") 063 public String getConflictingProductTypeName(); 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>Unique identifier of the Product Type containing the conflicting name.</p> 075 * @param conflictingProductTypeId value to be set 076 */ 077 078 public void setConflictingProductTypeId(final String conflictingProductTypeId); 079 080 /** 081 * <p>Name of the Product Type containing the conflicting name.</p> 082 * @param conflictingProductTypeName value to be set 083 */ 084 085 public void setConflictingProductTypeName(final String conflictingProductTypeName); 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 GraphQLAttributeDefinitionAlreadyExistsError 097 */ 098 public static GraphQLAttributeDefinitionAlreadyExistsError of() { 099 return new GraphQLAttributeDefinitionAlreadyExistsErrorImpl(); 100 } 101 102 /** 103 * factory method to create a shallow copy GraphQLAttributeDefinitionAlreadyExistsError 104 * @param template instance to be copied 105 * @return copy instance 106 */ 107 public static GraphQLAttributeDefinitionAlreadyExistsError of( 108 final GraphQLAttributeDefinitionAlreadyExistsError template) { 109 GraphQLAttributeDefinitionAlreadyExistsErrorImpl instance = new GraphQLAttributeDefinitionAlreadyExistsErrorImpl(); 110 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 111 instance.setConflictingProductTypeId(template.getConflictingProductTypeId()); 112 instance.setConflictingProductTypeName(template.getConflictingProductTypeName()); 113 instance.setConflictingAttributeName(template.getConflictingAttributeName()); 114 return instance; 115 } 116 117 /** 118 * factory method to create a deep copy of GraphQLAttributeDefinitionAlreadyExistsError 119 * @param template instance to be copied 120 * @return copy instance 121 */ 122 @Nullable 123 public static GraphQLAttributeDefinitionAlreadyExistsError deepCopy( 124 @Nullable final GraphQLAttributeDefinitionAlreadyExistsError template) { 125 if (template == null) { 126 return null; 127 } 128 GraphQLAttributeDefinitionAlreadyExistsErrorImpl instance = new GraphQLAttributeDefinitionAlreadyExistsErrorImpl(); 129 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 130 instance.setConflictingProductTypeId(template.getConflictingProductTypeId()); 131 instance.setConflictingProductTypeName(template.getConflictingProductTypeName()); 132 instance.setConflictingAttributeName(template.getConflictingAttributeName()); 133 return instance; 134 } 135 136 /** 137 * builder factory method for GraphQLAttributeDefinitionAlreadyExistsError 138 * @return builder 139 */ 140 public static GraphQLAttributeDefinitionAlreadyExistsErrorBuilder builder() { 141 return GraphQLAttributeDefinitionAlreadyExistsErrorBuilder.of(); 142 } 143 144 /** 145 * create builder for GraphQLAttributeDefinitionAlreadyExistsError instance 146 * @param template instance with prefilled values for the builder 147 * @return builder 148 */ 149 public static GraphQLAttributeDefinitionAlreadyExistsErrorBuilder builder( 150 final GraphQLAttributeDefinitionAlreadyExistsError template) { 151 return GraphQLAttributeDefinitionAlreadyExistsErrorBuilder.of(template); 152 } 153 154 /** 155 * accessor map function 156 * @param <T> mapped type 157 * @param helper function to map the object 158 * @return mapped value 159 */ 160 default <T> T withGraphQLAttributeDefinitionAlreadyExistsError( 161 Function<GraphQLAttributeDefinitionAlreadyExistsError, T> helper) { 162 return helper.apply(this); 163 } 164 165 /** 166 * gives a TypeReference for usage with Jackson DataBind 167 * @return TypeReference 168 */ 169 public static com.fasterxml.jackson.core.type.TypeReference<GraphQLAttributeDefinitionAlreadyExistsError> typeReference() { 170 return new com.fasterxml.jackson.core.type.TypeReference<GraphQLAttributeDefinitionAlreadyExistsError>() { 171 @Override 172 public String toString() { 173 return "TypeReference<GraphQLAttributeDefinitionAlreadyExistsError>"; 174 } 175 }; 176 } 177}