com.commercetools.history.models.common.AttributeDefinition Maven / Gradle / Ivy
Show all versions of commercetools-sdk-java-history Show documentation
package com.commercetools.history.models.common;
import java.time.*;
import java.util.*;
import java.util.function.Function;
import javax.annotation.Nullable;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.*;
import io.vrap.rmf.base.client.utils.Generated;
/**
* AttributeDefinition
*
*
* Example to create an instance using the builder pattern
*
*
* AttributeDefinition attributeDefinition = AttributeDefinition.builder()
* .type(typeBuilder -> typeBuilder)
* .name("{name}")
* .label(labelBuilder -> labelBuilder)
* .isRequired(true)
* .attributeConstraint(AttributeConstraintEnum.NONE)
* .inputTip(inputTipBuilder -> inputTipBuilder)
* .inputHint(TextInputHint.SINGLE_LINE)
* .isSearchable(true)
* .build()
*
*
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
@JsonDeserialize(as = AttributeDefinitionImpl.class)
public interface AttributeDefinition {
/**
*
* @return type
*/
@NotNull
@Valid
@JsonProperty("type")
public AttributeType getType();
/**
* 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 (_
) and the hyphen-minus (-
). When using the same name
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 enum
or lenum
type and sets thereof.
* @return name
*/
@NotNull
@JsonProperty("name")
public String getName();
/**
*
* @return label
*/
@NotNull
@Valid
@JsonProperty("label")
public LocalizedString getLabel();
/**
* Whether the attribute is required to have a value.
* @return isRequired
*/
@NotNull
@JsonProperty("isRequired")
public Boolean getIsRequired();
/**
*
* @return attributeConstraint
*/
@NotNull
@JsonProperty("attributeConstraint")
public AttributeConstraintEnum getAttributeConstraint();
/**
*
* @return inputTip
*/
@NotNull
@Valid
@JsonProperty("inputTip")
public LocalizedString getInputTip();
/**
*
* @return inputHint
*/
@NotNull
@JsonProperty("inputHint")
public TextInputHint getInputHint();
/**
* 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 restricted to 10922 characters. 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.
* @return isSearchable
*/
@NotNull
@JsonProperty("isSearchable")
public Boolean getIsSearchable();
/**
* set type
* @param type value to be set
*/
public void setType(final AttributeType type);
/**
* 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 (_
) and the hyphen-minus (-
). When using the same name
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 enum
or lenum
type and sets thereof.
* @param name value to be set
*/
public void setName(final String name);
/**
* set label
* @param label value to be set
*/
public void setLabel(final LocalizedString label);
/**
* Whether the attribute is required to have a value.
* @param isRequired value to be set
*/
public void setIsRequired(final Boolean isRequired);
/**
* set attributeConstraint
* @param attributeConstraint value to be set
*/
public void setAttributeConstraint(final AttributeConstraintEnum attributeConstraint);
/**
* set inputTip
* @param inputTip value to be set
*/
public void setInputTip(final LocalizedString inputTip);
/**
* set inputHint
* @param inputHint value to be set
*/
public void setInputHint(final TextInputHint inputHint);
/**
* 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 restricted to 10922 characters. 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.
* @param isSearchable value to be set
*/
public void setIsSearchable(final Boolean isSearchable);
/**
* factory method
* @return instance of AttributeDefinition
*/
public static AttributeDefinition of() {
return new AttributeDefinitionImpl();
}
/**
* factory method to create a shallow copy AttributeDefinition
* @param template instance to be copied
* @return copy instance
*/
public static AttributeDefinition of(final AttributeDefinition template) {
AttributeDefinitionImpl instance = new AttributeDefinitionImpl();
instance.setType(template.getType());
instance.setName(template.getName());
instance.setLabel(template.getLabel());
instance.setIsRequired(template.getIsRequired());
instance.setAttributeConstraint(template.getAttributeConstraint());
instance.setInputTip(template.getInputTip());
instance.setInputHint(template.getInputHint());
instance.setIsSearchable(template.getIsSearchable());
return instance;
}
/**
* factory method to create a deep copy of AttributeDefinition
* @param template instance to be copied
* @return copy instance
*/
@Nullable
public static AttributeDefinition deepCopy(@Nullable final AttributeDefinition template) {
if (template == null) {
return null;
}
AttributeDefinitionImpl instance = new AttributeDefinitionImpl();
instance.setType(com.commercetools.history.models.common.AttributeType.deepCopy(template.getType()));
instance.setName(template.getName());
instance.setLabel(com.commercetools.history.models.common.LocalizedString.deepCopy(template.getLabel()));
instance.setIsRequired(template.getIsRequired());
instance.setAttributeConstraint(template.getAttributeConstraint());
instance.setInputTip(com.commercetools.history.models.common.LocalizedString.deepCopy(template.getInputTip()));
instance.setInputHint(template.getInputHint());
instance.setIsSearchable(template.getIsSearchable());
return instance;
}
/**
* builder factory method for AttributeDefinition
* @return builder
*/
public static AttributeDefinitionBuilder builder() {
return AttributeDefinitionBuilder.of();
}
/**
* create builder for AttributeDefinition instance
* @param template instance with prefilled values for the builder
* @return builder
*/
public static AttributeDefinitionBuilder builder(final AttributeDefinition template) {
return AttributeDefinitionBuilder.of(template);
}
/**
* accessor map function
* @param mapped type
* @param helper function to map the object
* @return mapped value
*/
default T withAttributeDefinition(Function helper) {
return helper.apply(this);
}
/**
* gives a TypeReference for usage with Jackson DataBind
* @return TypeReference
*/
public static com.fasterxml.jackson.core.type.TypeReference typeReference() {
return new com.fasterxml.jackson.core.type.TypeReference() {
@Override
public String toString() {
return "TypeReference";
}
};
}
}