Class CategoryDraftBuilder

java.lang.Object
com.commercetools.api.models.category.CategoryDraftBuilder
All Implemented Interfaces:
Builder<CategoryDraft>

public class CategoryDraftBuilder extends Object implements Builder<CategoryDraft>
CategoryDraftBuilder
Example to create an instance using the builder pattern

     CategoryDraft categoryDraft = CategoryDraft.builder()
             .name(nameBuilder -> nameBuilder)
             .slug(slugBuilder -> slugBuilder)
             .build()
 
  • Constructor Details

    • CategoryDraftBuilder

      public CategoryDraftBuilder()
  • Method Details

    • name

      Name of the Category.

      Parameters:
      builder - function to build the name value
      Returns:
      Builder
    • withName

      Name of the Category.

      Parameters:
      builder - function to build the name value
      Returns:
      Builder
    • name

      Name of the Category.

      Parameters:
      name - value to be set
      Returns:
      Builder
    • slug

      User-defined identifier used as a deep-link URL to the related Category. A Category can have the same slug for different Locales, but it must be unique across the Project. Valid slugs must match the pattern ^[A-Za-z0-9_-]{2,256}+$.

      Parameters:
      builder - function to build the slug value
      Returns:
      Builder
    • withSlug

      User-defined identifier used as a deep-link URL to the related Category. A Category can have the same slug for different Locales, but it must be unique across the Project. Valid slugs must match the pattern ^[A-Za-z0-9_-]{2,256}+$.

      Parameters:
      builder - function to build the slug value
      Returns:
      Builder
    • slug

      User-defined identifier used as a deep-link URL to the related Category. A Category can have the same slug for different Locales, but it must be unique across the Project. Valid slugs must match the pattern ^[A-Za-z0-9_-]{2,256}+$.

      Parameters:
      slug - value to be set
      Returns:
      Builder
    • description

      Description of the Category.

      Parameters:
      builder - function to build the description value
      Returns:
      Builder
    • withDescription

      Description of the Category.

      Parameters:
      builder - function to build the description value
      Returns:
      Builder
    • description

      public CategoryDraftBuilder description(@Nullable LocalizedString description)

      Description of the Category.

      Parameters:
      description - value to be set
      Returns:
      Builder
    • parent

      Parent Category of the Category. The parent can be set by its id or key.

      Parameters:
      builder - function to build the parent value
      Returns:
      Builder
    • withParent

      Parent Category of the Category. The parent can be set by its id or key.

      Parameters:
      builder - function to build the parent value
      Returns:
      Builder
    • parent

      public CategoryDraftBuilder parent(@Nullable CategoryResourceIdentifier parent)

      Parent Category of the Category. The parent can be set by its id or key.

      Parameters:
      parent - value to be set
      Returns:
      Builder
    • orderHint

      public CategoryDraftBuilder orderHint(@Nullable String orderHint)

      Decimal value between 0 and 1. Frontend applications can use this value for ordering Categories within the same level in the category tree. If not set, a random value will be assigned.

      Parameters:
      orderHint - value to be set
      Returns:
      Builder
    • externalId

      public CategoryDraftBuilder externalId(@Nullable String externalId)

      Additional identifier for external systems like customer relationship management (CRM) or enterprise resource planning (ERP).

      Parameters:
      externalId - value to be set
      Returns:
      Builder
    • metaTitle

      Name of the Category used by external search engines for improved search engine performance.

      Parameters:
      builder - function to build the metaTitle value
      Returns:
      Builder
    • withMetaTitle

      Name of the Category used by external search engines for improved search engine performance.

      Parameters:
      builder - function to build the metaTitle value
      Returns:
      Builder
    • metaTitle

      public CategoryDraftBuilder metaTitle(@Nullable LocalizedString metaTitle)

      Name of the Category used by external search engines for improved search engine performance.

      Parameters:
      metaTitle - value to be set
      Returns:
      Builder
    • metaDescription

      Description of the Category used by external search engines for improved search engine performance.

      Parameters:
      builder - function to build the metaDescription value
      Returns:
      Builder
    • withMetaDescription

      Description of the Category used by external search engines for improved search engine performance.

      Parameters:
      builder - function to build the metaDescription value
      Returns:
      Builder
    • metaDescription

      public CategoryDraftBuilder metaDescription(@Nullable LocalizedString metaDescription)

      Description of the Category used by external search engines for improved search engine performance.

      Parameters:
      metaDescription - value to be set
      Returns:
      Builder
    • metaKeywords

      Keywords related to the Category for improved search engine performance.

      Parameters:
      builder - function to build the metaKeywords value
      Returns:
      Builder
    • withMetaKeywords

      Keywords related to the Category for improved search engine performance.

      Parameters:
      builder - function to build the metaKeywords value
      Returns:
      Builder
    • metaKeywords

      public CategoryDraftBuilder metaKeywords(@Nullable LocalizedString metaKeywords)

      Keywords related to the Category for improved search engine performance.

      Parameters:
      metaKeywords - value to be set
      Returns:
      Builder
    • custom

      Custom Fields for the Category.

      Parameters:
      builder - function to build the custom value
      Returns:
      Builder
    • withCustom

      Custom Fields for the Category.

      Parameters:
      builder - function to build the custom value
      Returns:
      Builder
    • custom

      public CategoryDraftBuilder custom(@Nullable CustomFieldsDraft custom)

      Custom Fields for the Category.

      Parameters:
      custom - value to be set
      Returns:
      Builder
    • assets

      public CategoryDraftBuilder assets(@Nullable AssetDraft... assets)

      Media related to the Category.

      Parameters:
      assets - value to be set
      Returns:
      Builder
    • assets

      public CategoryDraftBuilder assets(@Nullable List<AssetDraft> assets)

      Media related to the Category.

      Parameters:
      assets - value to be set
      Returns:
      Builder
    • plusAssets

      public CategoryDraftBuilder plusAssets(@Nullable AssetDraft... assets)

      Media related to the Category.

      Parameters:
      assets - value to be set
      Returns:
      Builder
    • plusAssets

      Media related to the Category.

      Parameters:
      builder - function to build the assets value
      Returns:
      Builder
    • withAssets

      Media related to the Category.

      Parameters:
      builder - function to build the assets value
      Returns:
      Builder
    • addAssets

      Media related to the Category.

      Parameters:
      builder - function to build the assets value
      Returns:
      Builder
    • setAssets

      Media related to the Category.

      Parameters:
      builder - function to build the assets value
      Returns:
      Builder
    • key

      public CategoryDraftBuilder key(@Nullable String key)

      User-defined unique identifier for the Category.

      This field is optional for backwards compatibility reasons, but we strongly recommend setting it. Keys are mandatory for importing Categories with the Import API and the Merchant Center.

      Parameters:
      key - value to be set
      Returns:
      Builder
    • getName

      public LocalizedString getName()

      Name of the Category.

      Returns:
      name
    • getSlug

      public LocalizedString getSlug()

      User-defined identifier used as a deep-link URL to the related Category. A Category can have the same slug for different Locales, but it must be unique across the Project. Valid slugs must match the pattern ^[A-Za-z0-9_-]{2,256}+$.

      Returns:
      slug
    • getDescription

      @Nullable public LocalizedString getDescription()

      Description of the Category.

      Returns:
      description
    • getParent

      @Nullable public CategoryResourceIdentifier getParent()

      Parent Category of the Category. The parent can be set by its id or key.

      Returns:
      parent
    • getOrderHint

      @Nullable public String getOrderHint()

      Decimal value between 0 and 1. Frontend applications can use this value for ordering Categories within the same level in the category tree. If not set, a random value will be assigned.

      Returns:
      orderHint
    • getExternalId

      @Nullable public String getExternalId()

      Additional identifier for external systems like customer relationship management (CRM) or enterprise resource planning (ERP).

      Returns:
      externalId
    • getMetaTitle

      @Nullable public LocalizedString getMetaTitle()

      Name of the Category used by external search engines for improved search engine performance.

      Returns:
      metaTitle
    • getMetaDescription

      @Nullable public LocalizedString getMetaDescription()

      Description of the Category used by external search engines for improved search engine performance.

      Returns:
      metaDescription
    • getMetaKeywords

      @Nullable public LocalizedString getMetaKeywords()

      Keywords related to the Category for improved search engine performance.

      Returns:
      metaKeywords
    • getCustom

      @Nullable public CustomFieldsDraft getCustom()

      Custom Fields for the Category.

      Returns:
      custom
    • getAssets

      @Nullable public List<AssetDraft> getAssets()

      Media related to the Category.

      Returns:
      assets
    • getKey

      @Nullable public String getKey()

      User-defined unique identifier for the Category.

      This field is optional for backwards compatibility reasons, but we strongly recommend setting it. Keys are mandatory for importing Categories with the Import API and the Merchant Center.

      Returns:
      key
    • build

      public CategoryDraft build()
      builds CategoryDraft with checking for non-null required values
      Specified by:
      build in interface Builder<CategoryDraft>
      Returns:
      CategoryDraft
    • buildUnchecked

      public CategoryDraft buildUnchecked()
      builds CategoryDraft without checking for non-null required values
      Returns:
      CategoryDraft
    • of

      public static CategoryDraftBuilder of()
      factory method for an instance of CategoryDraftBuilder
      Returns:
      builder
    • of

      public static CategoryDraftBuilder of(CategoryDraft template)
      create builder for CategoryDraft instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder