001 002package com.commercetools.history.models.common; 003 004import java.time.*; 005import java.util.*; 006 007import com.fasterxml.jackson.annotation.JsonCreator; 008import com.fasterxml.jackson.annotation.JsonProperty; 009import com.fasterxml.jackson.databind.annotation.*; 010 011import io.vrap.rmf.base.client.ModelBase; 012import io.vrap.rmf.base.client.utils.Generated; 013 014import org.apache.commons.lang3.builder.EqualsBuilder; 015import org.apache.commons.lang3.builder.HashCodeBuilder; 016 017/** 018 * AttributeDefinition 019 */ 020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 021public class AttributeDefinitionImpl implements AttributeDefinition, ModelBase { 022 023 private com.commercetools.history.models.common.AttributeType type; 024 025 private String name; 026 027 private com.commercetools.history.models.common.LocalizedString label; 028 029 private Boolean isRequired; 030 031 private com.commercetools.history.models.common.AttributeConstraintEnum attributeConstraint; 032 033 private com.commercetools.history.models.common.LocalizedString inputTip; 034 035 private com.commercetools.history.models.common.TextInputHint inputHint; 036 037 private Boolean isSearchable; 038 039 /** 040 * create instance with all properties 041 */ 042 @JsonCreator 043 AttributeDefinitionImpl(@JsonProperty("type") final com.commercetools.history.models.common.AttributeType type, 044 @JsonProperty("name") final String name, 045 @JsonProperty("label") final com.commercetools.history.models.common.LocalizedString label, 046 @JsonProperty("isRequired") final Boolean isRequired, 047 @JsonProperty("attributeConstraint") final com.commercetools.history.models.common.AttributeConstraintEnum attributeConstraint, 048 @JsonProperty("inputTip") final com.commercetools.history.models.common.LocalizedString inputTip, 049 @JsonProperty("inputHint") final com.commercetools.history.models.common.TextInputHint inputHint, 050 @JsonProperty("isSearchable") final Boolean isSearchable) { 051 this.type = type; 052 this.name = name; 053 this.label = label; 054 this.isRequired = isRequired; 055 this.attributeConstraint = attributeConstraint; 056 this.inputTip = inputTip; 057 this.inputHint = inputHint; 058 this.isSearchable = isSearchable; 059 } 060 061 /** 062 * create empty instance 063 */ 064 public AttributeDefinitionImpl() { 065 } 066 067 /** 068 * 069 */ 070 071 public com.commercetools.history.models.common.AttributeType getType() { 072 return this.type; 073 } 074 075 /** 076 * <p>The unique name of the attribute used in the API. The name must be between two and 256 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (<code>_</code>) and the hyphen-minus (<code>-</code>). When using the same <code>name</code> for an attribute in two or more product types all fields of the AttributeDefinition of this attribute need to be the same across the product types, otherwise an AttributeDefinitionAlreadyExists error code will be returned. An exception to this are the values of an <code>enum</code> or <code>lenum</code> type and sets thereof.</p> 077 */ 078 079 public String getName() { 080 return this.name; 081 } 082 083 /** 084 * 085 */ 086 087 public com.commercetools.history.models.common.LocalizedString getLabel() { 088 return this.label; 089 } 090 091 /** 092 * <p>Whether the attribute is required to have a value.</p> 093 */ 094 095 public Boolean getIsRequired() { 096 return this.isRequired; 097 } 098 099 /** 100 * 101 */ 102 103 public com.commercetools.history.models.common.AttributeConstraintEnum getAttributeConstraint() { 104 return this.attributeConstraint; 105 } 106 107 /** 108 * 109 */ 110 111 public com.commercetools.history.models.common.LocalizedString getInputTip() { 112 return this.inputTip; 113 } 114 115 /** 116 * 117 */ 118 119 public com.commercetools.history.models.common.TextInputHint getInputHint() { 120 return this.inputHint; 121 } 122 123 /** 124 * <p>Whether the attribute's values should generally be enabled in product search. This determines whether the value is stored in products for matching terms in the context of full-text search queries and can be used in facets & filters as part of product search queries. The exact features that are enabled/disabled with this flag depend on the concrete attribute type and are described there. The max size of a searchable field is <strong>restricted to 10922 characters</strong>. This constraint is enforced at both product creation and product update. If the length of the input exceeds the maximum size an InvalidField error is returned.</p> 125 */ 126 127 public Boolean getIsSearchable() { 128 return this.isSearchable; 129 } 130 131 public void setType(final com.commercetools.history.models.common.AttributeType type) { 132 this.type = type; 133 } 134 135 public void setName(final String name) { 136 this.name = name; 137 } 138 139 public void setLabel(final com.commercetools.history.models.common.LocalizedString label) { 140 this.label = label; 141 } 142 143 public void setIsRequired(final Boolean isRequired) { 144 this.isRequired = isRequired; 145 } 146 147 public void setAttributeConstraint( 148 final com.commercetools.history.models.common.AttributeConstraintEnum attributeConstraint) { 149 this.attributeConstraint = attributeConstraint; 150 } 151 152 public void setInputTip(final com.commercetools.history.models.common.LocalizedString inputTip) { 153 this.inputTip = inputTip; 154 } 155 156 public void setInputHint(final com.commercetools.history.models.common.TextInputHint inputHint) { 157 this.inputHint = inputHint; 158 } 159 160 public void setIsSearchable(final Boolean isSearchable) { 161 this.isSearchable = isSearchable; 162 } 163 164 @Override 165 public boolean equals(Object o) { 166 if (this == o) 167 return true; 168 169 if (o == null || getClass() != o.getClass()) 170 return false; 171 172 AttributeDefinitionImpl that = (AttributeDefinitionImpl) o; 173 174 return new EqualsBuilder().append(type, that.type) 175 .append(name, that.name) 176 .append(label, that.label) 177 .append(isRequired, that.isRequired) 178 .append(attributeConstraint, that.attributeConstraint) 179 .append(inputTip, that.inputTip) 180 .append(inputHint, that.inputHint) 181 .append(isSearchable, that.isSearchable) 182 .append(type, that.type) 183 .append(name, that.name) 184 .append(label, that.label) 185 .append(isRequired, that.isRequired) 186 .append(attributeConstraint, that.attributeConstraint) 187 .append(inputTip, that.inputTip) 188 .append(inputHint, that.inputHint) 189 .append(isSearchable, that.isSearchable) 190 .isEquals(); 191 } 192 193 @Override 194 public int hashCode() { 195 return new HashCodeBuilder(17, 37).append(type) 196 .append(name) 197 .append(label) 198 .append(isRequired) 199 .append(attributeConstraint) 200 .append(inputTip) 201 .append(inputHint) 202 .append(isSearchable) 203 .toHashCode(); 204 } 205 206}