Interface AttributeDefinition
Describes a Product Attribute and allows you to define meta-information associated with the Attribute (like whether it should be searchable, or its constraints).
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)
.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
Specifies how Attributes are validated across all variants of a Product.@NotNull TextInputHint
Provides a visual representation directive for values of this Attribute (only relevant for AttributeTextType and AttributeLocalizableTextType).@Valid LocalizedString
Provides additional Attribute information to aid content managers configure Product details.@NotNull Boolean
Iftrue
, the Attribute must have a value on a ProductVariant.@NotNull Boolean
Iftrue
, the Attribute's values are available for the Product Projections Search API for use in full-text search queries, filters, and facets.@NotNull @Valid LocalizedString
getLabel()
Human-readable label for the Attribute.@NotNull String
getName()
User-defined name of the Attribute that is unique within the Project.@NotNull @Valid AttributeType
getType()
Describes the Type of the Attribute.static AttributeDefinition
of()
factory methodstatic AttributeDefinition
of
(AttributeDefinition template) factory method to create a shallow copy AttributeDefinitionvoid
setAttributeConstraint
(AttributeConstraintEnum attributeConstraint) Specifies how Attributes are validated across all variants of a Product.void
setInputHint
(TextInputHint inputHint) Provides a visual representation directive for values of this Attribute (only relevant for AttributeTextType and AttributeLocalizableTextType).void
setInputTip
(LocalizedString inputTip) Provides additional Attribute information to aid content managers configure Product details.void
setIsRequired
(Boolean isRequired) Iftrue
, the Attribute must have a value on a ProductVariant.void
setIsSearchable
(Boolean isSearchable) Iftrue
, the Attribute's values are available for the Product Projections Search API for use in full-text search queries, filters, and facets.void
setLabel
(LocalizedString label) Human-readable label for the Attribute.void
User-defined name of the Attribute that is unique within the Project.void
setType
(AttributeType type) Describes the Type of the Attribute.static 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
Describes the Type of the Attribute.
- Returns:
- type
-
getName
User-defined name of the Attribute that is unique within the Project.
- Returns:
- name
-
getLabel
Human-readable label for the Attribute.
- Returns:
- label
-
getIsRequired
If
true
, the Attribute must have a value on a ProductVariant.- Returns:
- isRequired
-
getAttributeConstraint
Specifies how Attributes are validated across all variants of a Product.
- Returns:
- attributeConstraint
-
getInputTip
Provides additional Attribute information to aid content managers configure Product details.
- Returns:
- inputTip
-
getInputHint
Provides a visual representation directive for values of this Attribute (only relevant for AttributeTextType and AttributeLocalizableTextType).
- Returns:
- inputHint
-
getIsSearchable
If
true
, the Attribute's values are available for the Product Projections Search API for use in full-text search queries, filters, and facets.Which exact features are available with this flag depends on the specific AttributeType. The maximum size of a searchable field is restricted by the Field content size limit. 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
Describes the Type of the Attribute.
- Parameters:
type
- value to be set
-
setName
User-defined name of the Attribute that is unique within the Project.
- Parameters:
name
- value to be set
-
setLabel
Human-readable label for the Attribute.
- Parameters:
label
- value to be set
-
setIsRequired
If
true
, the Attribute must have a value on a ProductVariant.- Parameters:
isRequired
- value to be set
-
setAttributeConstraint
Specifies how Attributes are validated across all variants of a Product.
- Parameters:
attributeConstraint
- value to be set
-
setInputTip
Provides additional Attribute information to aid content managers configure Product details.
- Parameters:
inputTip
- value to be set
-
setInputHint
Provides a visual representation directive for values of this Attribute (only relevant for AttributeTextType and AttributeLocalizableTextType).
- Parameters:
inputHint
- value to be set
-
setIsSearchable
If
true
, the Attribute's values are available for the Product Projections Search API for use in full-text search queries, filters, and facets.Which exact features are available with this flag depends on the specific AttributeType. The maximum size of a searchable field is restricted by the Field content size limit. 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
-