Interface AttributeDefinition


public interface AttributeDefinition
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 Details

    • getType

      @NotNull @Valid @NotNull @Valid AttributeType getType()
      Returns:
      type
    • getName

      @NotNull @NotNull String 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 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.

      Returns:
      name
    • getLabel

      @NotNull @Valid @NotNull @Valid LocalizedString getLabel()
      Returns:
      label
    • getIsRequired

      @NotNull @NotNull Boolean getIsRequired()

      Whether the attribute is required to have a value.

      Returns:
      isRequired
    • getAttributeConstraint

      @NotNull @NotNull AttributeConstraintEnum getAttributeConstraint()
      Returns:
      attributeConstraint
    • getInputTip

      @NotNull @Valid @NotNull @Valid LocalizedString getInputTip()
      Returns:
      inputTip
    • getInputHint

      @NotNull @NotNull TextInputHint getInputHint()
      Returns:
      inputHint
    • getIsSearchable

      @NotNull @NotNull Boolean 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

      void setType(AttributeType type)
      set type
      Parameters:
      type - value to be set
    • setName

      void setName(String name)

      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.

      Parameters:
      name - value to be set
    • setLabel

      void setLabel(LocalizedString label)
      set label
      Parameters:
      label - value to be set
    • setIsRequired

      void setIsRequired(Boolean isRequired)

      Whether the attribute is required to have a value.

      Parameters:
      isRequired - value to be set
    • setAttributeConstraint

      void setAttributeConstraint(AttributeConstraintEnum attributeConstraint)
      set attributeConstraint
      Parameters:
      attributeConstraint - value to be set
    • setInputTip

      void setInputTip(LocalizedString inputTip)
      set inputTip
      Parameters:
      inputTip - value to be set
    • setInputHint

      void setInputHint(TextInputHint inputHint)
      set inputHint
      Parameters:
      inputHint - value to be set
    • setIsSearchable

      void setIsSearchable(Boolean isSearchable)

      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

      static AttributeDefinition 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

      static AttributeDefinitionBuilder 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

      default <T> T withAttributeDefinition(Function<AttributeDefinition,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static com.fasterxml.jackson.core.type.TypeReference<AttributeDefinition> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference