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 * AttributeDefinitionAlreadyExistsError attributeDefinitionAlreadyExistsError = AttributeDefinitionAlreadyExistsError.builder() 025 * .message("{message}") 026 * .conflictingProductTypeId("{conflictingProductTypeId}") 027 * .conflictingProductTypeName("{conflictingProductTypeName}") 028 * .conflictingAttributeName("{conflictingAttributeName}") 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 = AttributeDefinitionAlreadyExistsErrorImpl.class) 035public interface AttributeDefinitionAlreadyExistsError extends ErrorObject { 036 037 /** 038 * discriminator value for AttributeDefinitionAlreadyExistsError 039 */ 040 String ATTRIBUTE_DEFINITION_ALREADY_EXISTS = "AttributeDefinitionAlreadyExists"; 041 042 /** 043 * 044 * @return code 045 */ 046 @NotNull 047 @JsonProperty("code") 048 public String getCode(); 049 050 /** 051 * <p><code>"An attribute definition with name $attributeName already exists on product type $productTypeName."</code></p> 052 * @return message 053 */ 054 @NotNull 055 @JsonProperty("message") 056 public String getMessage(); 057 058 /** 059 * <p>Unique identifier of the Product Type containing the conflicting name.</p> 060 * @return conflictingProductTypeId 061 */ 062 @NotNull 063 @JsonProperty("conflictingProductTypeId") 064 public String getConflictingProductTypeId(); 065 066 /** 067 * <p>Name of the Product Type containing the conflicting name.</p> 068 * @return conflictingProductTypeName 069 */ 070 @NotNull 071 @JsonProperty("conflictingProductTypeName") 072 public String getConflictingProductTypeName(); 073 074 /** 075 * <p>Name of the conflicting Attribute.</p> 076 * @return conflictingAttributeName 077 */ 078 @NotNull 079 @JsonProperty("conflictingAttributeName") 080 public String getConflictingAttributeName(); 081 082 /** 083 * <p><code>"An attribute definition with name $attributeName already exists on product type $productTypeName."</code></p> 084 * @param message value to be set 085 */ 086 087 public void setMessage(final String message); 088 089 /** 090 * <p>Unique identifier of the Product Type containing the conflicting name.</p> 091 * @param conflictingProductTypeId value to be set 092 */ 093 094 public void setConflictingProductTypeId(final String conflictingProductTypeId); 095 096 /** 097 * <p>Name of the Product Type containing the conflicting name.</p> 098 * @param conflictingProductTypeName value to be set 099 */ 100 101 public void setConflictingProductTypeName(final String conflictingProductTypeName); 102 103 /** 104 * <p>Name of the conflicting Attribute.</p> 105 * @param conflictingAttributeName value to be set 106 */ 107 108 public void setConflictingAttributeName(final String conflictingAttributeName); 109 110 /** 111 * factory method 112 * @return instance of AttributeDefinitionAlreadyExistsError 113 */ 114 public static AttributeDefinitionAlreadyExistsError of() { 115 return new AttributeDefinitionAlreadyExistsErrorImpl(); 116 } 117 118 /** 119 * factory method to create a shallow copy AttributeDefinitionAlreadyExistsError 120 * @param template instance to be copied 121 * @return copy instance 122 */ 123 public static AttributeDefinitionAlreadyExistsError of(final AttributeDefinitionAlreadyExistsError template) { 124 AttributeDefinitionAlreadyExistsErrorImpl instance = new AttributeDefinitionAlreadyExistsErrorImpl(); 125 instance.setMessage(template.getMessage()); 126 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 127 instance.setConflictingProductTypeId(template.getConflictingProductTypeId()); 128 instance.setConflictingProductTypeName(template.getConflictingProductTypeName()); 129 instance.setConflictingAttributeName(template.getConflictingAttributeName()); 130 return instance; 131 } 132 133 /** 134 * factory method to create a deep copy of AttributeDefinitionAlreadyExistsError 135 * @param template instance to be copied 136 * @return copy instance 137 */ 138 @Nullable 139 public static AttributeDefinitionAlreadyExistsError deepCopy( 140 @Nullable final AttributeDefinitionAlreadyExistsError template) { 141 if (template == null) { 142 return null; 143 } 144 AttributeDefinitionAlreadyExistsErrorImpl instance = new AttributeDefinitionAlreadyExistsErrorImpl(); 145 instance.setMessage(template.getMessage()); 146 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 147 instance.setConflictingProductTypeId(template.getConflictingProductTypeId()); 148 instance.setConflictingProductTypeName(template.getConflictingProductTypeName()); 149 instance.setConflictingAttributeName(template.getConflictingAttributeName()); 150 return instance; 151 } 152 153 /** 154 * builder factory method for AttributeDefinitionAlreadyExistsError 155 * @return builder 156 */ 157 public static AttributeDefinitionAlreadyExistsErrorBuilder builder() { 158 return AttributeDefinitionAlreadyExistsErrorBuilder.of(); 159 } 160 161 /** 162 * create builder for AttributeDefinitionAlreadyExistsError instance 163 * @param template instance with prefilled values for the builder 164 * @return builder 165 */ 166 public static AttributeDefinitionAlreadyExistsErrorBuilder builder( 167 final AttributeDefinitionAlreadyExistsError template) { 168 return AttributeDefinitionAlreadyExistsErrorBuilder.of(template); 169 } 170 171 /** 172 * accessor map function 173 * @param <T> mapped type 174 * @param helper function to map the object 175 * @return mapped value 176 */ 177 default <T> T withAttributeDefinitionAlreadyExistsError(Function<AttributeDefinitionAlreadyExistsError, T> helper) { 178 return helper.apply(this); 179 } 180 181 /** 182 * gives a TypeReference for usage with Jackson DataBind 183 * @return TypeReference 184 */ 185 public static com.fasterxml.jackson.core.type.TypeReference<AttributeDefinitionAlreadyExistsError> typeReference() { 186 return new com.fasterxml.jackson.core.type.TypeReference<AttributeDefinitionAlreadyExistsError>() { 187 @Override 188 public String toString() { 189 return "TypeReference<AttributeDefinitionAlreadyExistsError>"; 190 } 191 }; 192 } 193}