001
002package com.commercetools.api.models.type;
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 *  <p>Defines a Custom Field and its meta-information. This FieldDefinition is similar to an AttributeDefinition of Product Types.</p>
019 */
020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
021public class FieldDefinitionImpl implements FieldDefinition, ModelBase {
022
023    private com.commercetools.api.models.type.FieldType type;
024
025    private String name;
026
027    private com.commercetools.api.models.common.LocalizedString label;
028
029    private Boolean required;
030
031    private com.commercetools.api.models.type.TypeTextInputHint inputHint;
032
033    /**
034     * create instance with all properties
035     */
036    @JsonCreator
037    FieldDefinitionImpl(@JsonProperty("type") final com.commercetools.api.models.type.FieldType type,
038            @JsonProperty("name") final String name,
039            @JsonProperty("label") final com.commercetools.api.models.common.LocalizedString label,
040            @JsonProperty("required") final Boolean required,
041            @JsonProperty("inputHint") final com.commercetools.api.models.type.TypeTextInputHint inputHint) {
042        this.type = type;
043        this.name = name;
044        this.label = label;
045        this.required = required;
046        this.inputHint = inputHint;
047    }
048
049    /**
050     * create empty instance
051     */
052    public FieldDefinitionImpl() {
053    }
054
055    /**
056     *  <p>Data type of the Custom Field to define.</p>
057     */
058
059    public com.commercetools.api.models.type.FieldType getType() {
060        return this.type;
061    }
062
063    /**
064     *  <p>Name of the Custom Field to define. Must be unique for a given ResourceTypeId. In case there is a FieldDefinition with the same <code>name</code> in another Type, both FieldDefinitions must have the same <code>type</code>.</p>
065     */
066
067    public String getName() {
068        return this.name;
069    }
070
071    /**
072     *  <p>A human-readable label for the field.</p>
073     */
074
075    public com.commercetools.api.models.common.LocalizedString getLabel() {
076        return this.label;
077    }
078
079    /**
080     *  <p>Defines whether the field is required to have a value.</p>
081     */
082
083    public Boolean getRequired() {
084        return this.required;
085    }
086
087    /**
088     *  <p>Defines the visual representation of the field in user interfaces like the Merchant Center. It is only relevant for string-based FieldTypes like CustomFieldStringType and CustomFieldLocalizedStringType.</p>
089     */
090
091    public com.commercetools.api.models.type.TypeTextInputHint getInputHint() {
092        return this.inputHint;
093    }
094
095    public void setType(final com.commercetools.api.models.type.FieldType type) {
096        this.type = type;
097    }
098
099    public void setName(final String name) {
100        this.name = name;
101    }
102
103    public void setLabel(final com.commercetools.api.models.common.LocalizedString label) {
104        this.label = label;
105    }
106
107    public void setRequired(final Boolean required) {
108        this.required = required;
109    }
110
111    public void setInputHint(final com.commercetools.api.models.type.TypeTextInputHint inputHint) {
112        this.inputHint = inputHint;
113    }
114
115    @Override
116    public boolean equals(Object o) {
117        if (this == o)
118            return true;
119
120        if (o == null || getClass() != o.getClass())
121            return false;
122
123        FieldDefinitionImpl that = (FieldDefinitionImpl) o;
124
125        return new EqualsBuilder().append(type, that.type)
126                .append(name, that.name)
127                .append(label, that.label)
128                .append(required, that.required)
129                .append(inputHint, that.inputHint)
130                .isEquals();
131    }
132
133    @Override
134    public int hashCode() {
135        return new HashCodeBuilder(17, 37).append(type)
136                .append(name)
137                .append(label)
138                .append(required)
139                .append(inputHint)
140                .toHashCode();
141    }
142
143}