Class CategoryBuilder

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

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

     Category category = Category.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .name(nameBuilder -> nameBuilder)
             .slug(slugBuilder -> slugBuilder)
             .plusAncestors(ancestorsBuilder -> ancestorsBuilder)
             .orderHint("{orderHint}")
             .build()
 
  • Constructor Details

    • CategoryBuilder

      public CategoryBuilder()
  • Method Details

    • id

      public CategoryBuilder id(String id)

      Unique identifier of the Category.

      Parameters:
      id - value to be set
      Returns:
      Builder
    • version

      public CategoryBuilder version(Long version)

      Current version of the Category.

      Parameters:
      version - value to be set
      Returns:
      Builder
    • createdAt

      public CategoryBuilder createdAt(ZonedDateTime createdAt)

      Date and time (UTC) the Category was initially created.

      Parameters:
      createdAt - value to be set
      Returns:
      Builder
    • lastModifiedAt

      public CategoryBuilder lastModifiedAt(ZonedDateTime lastModifiedAt)

      Date and time (UTC) the Category was last updated.

      Parameters:
      lastModifiedAt - value to be set
      Returns:
      Builder
    • lastModifiedBy

      IDs and references that last modified the Category.

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

      public CategoryBuilder withLastModifiedBy(Function<LastModifiedByBuilder,LastModifiedBy> builder)

      IDs and references that last modified the Category.

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

      public CategoryBuilder lastModifiedBy(@Nullable LastModifiedBy lastModifiedBy)

      IDs and references that last modified the Category.

      Parameters:
      lastModifiedBy - value to be set
      Returns:
      Builder
    • createdBy

      IDs and references that created the Category.

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

      public CategoryBuilder withCreatedBy(Function<CreatedByBuilder,CreatedBy> builder)

      IDs and references that created the Category.

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

      public CategoryBuilder createdBy(@Nullable CreatedBy createdBy)

      IDs and references that created the Category.

      Parameters:
      createdBy - value to be set
      Returns:
      Builder
    • 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

      public CategoryBuilder name(LocalizedString 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 per Locale. A Category can have the same slug for different Locales, but they are unique across the Project. Valid slugs match the pattern ^[A-Za-z0-9_-]{2,256}+$. For good performance, indexes are provided for the first 15 languages set in a Project.

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

      User-defined identifier used as a deep-link URL to the related Category per Locale. A Category can have the same slug for different Locales, but they are unique across the Project. Valid slugs match the pattern ^[A-Za-z0-9_-]{2,256}+$. For good performance, indexes are provided for the first 15 languages set in a Project.

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

      public CategoryBuilder slug(LocalizedString slug)

      User-defined identifier used as a deep-link URL to the related Category per Locale. A Category can have the same slug for different Locales, but they are unique across the Project. Valid slugs match the pattern ^[A-Za-z0-9_-]{2,256}+$. For good performance, indexes are provided for the first 15 languages set in a Project.

      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 CategoryBuilder description(@Nullable LocalizedString description)

      Description of the Category.

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

      public CategoryBuilder ancestors(CategoryReference... ancestors)

      Contains the parent path towards the root Category.

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

      public CategoryBuilder ancestors(List<CategoryReference> ancestors)

      Contains the parent path towards the root Category.

      Parameters:
      ancestors - value to be set
      Returns:
      Builder
    • plusAncestors

      public CategoryBuilder plusAncestors(CategoryReference... ancestors)

      Contains the parent path towards the root Category.

      Parameters:
      ancestors - value to be set
      Returns:
      Builder
    • plusAncestors

      Contains the parent path towards the root Category.

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

      Contains the parent path towards the root Category.

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

      Contains the parent path towards the root Category.

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

      Contains the parent path towards the root Category.

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

      Parent Category of this Category.

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

      Parent Category of this Category.

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

      Parent Category of this Category.

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

      public CategoryBuilder orderHint(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.

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

      public CategoryBuilder 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 CategoryBuilder 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

      public CategoryBuilder withMetaDescription(Function<LocalizedStringBuilder,LocalizedString> builder)

      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 CategoryBuilder 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

      public CategoryBuilder withMetaKeywords(Function<LocalizedStringBuilder,LocalizedString> builder)

      Keywords related to the Category for improved search engine performance.

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

      public CategoryBuilder 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 CategoryBuilder custom(@Nullable CustomFields custom)

      Custom Fields for the Category.

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

      public CategoryBuilder assets(@Nullable Asset... assets)

      Media related to the Category.

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

      public CategoryBuilder assets(@Nullable List<Asset> assets)

      Media related to the Category.

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

      public CategoryBuilder plusAssets(@Nullable Asset... assets)

      Media related to the Category.

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

      public CategoryBuilder plusAssets(Function<AssetBuilder,AssetBuilder> builder)

      Media related to the Category.

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

      public CategoryBuilder withAssets(Function<AssetBuilder,AssetBuilder> builder)

      Media related to the Category.

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

      public CategoryBuilder addAssets(Function<AssetBuilder,Asset> builder)

      Media related to the Category.

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

      public CategoryBuilder setAssets(Function<AssetBuilder,Asset> builder)

      Media related to the Category.

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

      public CategoryBuilder key(@Nullable String key)

      User-defined unique identifier of the Category.

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

      public String getId()

      Unique identifier of the Category.

      Returns:
      id
    • getVersion

      public Long getVersion()

      Current version of the Category.

      Returns:
      version
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

      Date and time (UTC) the Category was initially created.

      Returns:
      createdAt
    • getLastModifiedAt

      public ZonedDateTime getLastModifiedAt()

      Date and time (UTC) the Category was last updated.

      Returns:
      lastModifiedAt
    • getLastModifiedBy

      @Nullable public LastModifiedBy getLastModifiedBy()

      IDs and references that last modified the Category.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Nullable public CreatedBy getCreatedBy()

      IDs and references that created the Category.

      Returns:
      createdBy
    • 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 per Locale. A Category can have the same slug for different Locales, but they are unique across the Project. Valid slugs match the pattern ^[A-Za-z0-9_-]{2,256}+$. For good performance, indexes are provided for the first 15 languages set in a Project.

      Returns:
      slug
    • getDescription

      @Nullable public LocalizedString getDescription()

      Description of the Category.

      Returns:
      description
    • getAncestors

      public List<CategoryReference> getAncestors()

      Contains the parent path towards the root Category.

      Returns:
      ancestors
    • getParent

      @Nullable public CategoryReference getParent()

      Parent Category of this Category.

      Returns:
      parent
    • getOrderHint

      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.

      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 CustomFields getCustom()

      Custom Fields for the Category.

      Returns:
      custom
    • getAssets

      @Nullable public List<Asset> getAssets()

      Media related to the Category.

      Returns:
      assets
    • getKey

      @Nullable public String getKey()

      User-defined unique identifier of the Category.

      Returns:
      key
    • build

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

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

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

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