Interface 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()
-
Method Summary
Modifier and TypeMethodDescriptionstatic AttributeDefinitionBuilder
builder()
builder factory method for AttributeDefinitionstatic AttributeDefinitionBuilder
builder
(AttributeDefinition template) create builder for AttributeDefinition instancestatic AttributeDefinition
deepCopy
(AttributeDefinition template) factory method to create a deep copy of AttributeDefinition@NotNull AttributeConstraintEnum
@NotNull TextInputHint
@NotNull @Valid LocalizedString
@NotNull Boolean
Whether the attribute is required to have a value.@NotNull Boolean
Whether the attribute's values should generally be enabled in product search.@NotNull @Valid LocalizedString
getLabel()
@NotNull String
getName()
The unique name of the attribute used in the API.@NotNull @Valid AttributeType
getType()
static AttributeDefinition
of()
factory methodstatic AttributeDefinition
of
(AttributeDefinition template) factory method to create a shallow copy AttributeDefinitionvoid
setAttributeConstraint
(AttributeConstraintEnum attributeConstraint) set attributeConstraintvoid
setInputHint
(TextInputHint inputHint) set inputHintvoid
setInputTip
(LocalizedString inputTip) set inputTipvoid
setIsRequired
(Boolean isRequired) Whether the attribute is required to have a value.void
setIsSearchable
(Boolean isSearchable) Whether the attribute's values should generally be enabled in product search.void
setLabel
(LocalizedString label) set labelvoid
The unique name of the attribute used in the API.void
setType
(AttributeType type) set typestatic com.fasterxml.jackson.core.type.TypeReference<AttributeDefinition>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withAttributeDefinition
(Function<AttributeDefinition, T> helper) accessor map function
-
Method Details
-
getType
- Returns:
- type
-
getName
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 samename
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 anenum
orlenum
type and sets thereof.- Returns:
- name
-
getLabel
- Returns:
- label
-
getIsRequired
Whether the attribute is required to have a value.
- Returns:
- isRequired
-
getAttributeConstraint
- Returns:
- attributeConstraint
-
getInputTip
- Returns:
- inputTip
-
getInputHint
- Returns:
- inputHint
-
getIsSearchable
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.
- Returns:
- isSearchable
-
setType
set type- Parameters:
type
- value to be set
-
setName
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 samename
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 anenum
orlenum
type and sets thereof.- Parameters:
name
- value to be set
-
setLabel
set label- Parameters:
label
- value to be set
-
setIsRequired
Whether the attribute is required to have a value.
- Parameters:
isRequired
- value to be set
-
setAttributeConstraint
set attributeConstraint- Parameters:
attributeConstraint
- value to be set
-
setInputTip
set inputTip- Parameters:
inputTip
- value to be set
-
setInputHint
set inputHint- Parameters:
inputHint
- value to be set
-
setIsSearchable
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.
- Parameters:
isSearchable
- value to be set
-
of
factory method- Returns:
- instance of AttributeDefinition
-
of
factory method to create a shallow copy AttributeDefinition- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
factory method to create a deep copy of AttributeDefinition- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for AttributeDefinition- Returns:
- builder
-
builder
create builder for AttributeDefinition instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withAttributeDefinition
accessor map function- Type Parameters:
T
- mapped type- Parameters:
helper
- function to map the object- Returns:
- mapped value
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-