Class ProjectBuilder

java.lang.Object
com.commercetools.api.models.project.ProjectBuilder
All Implemented Interfaces:
Builder<Project>

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

     Project project = Project.builder()
             .version(0.3)
             .key("{key}")
             .name("{name}")
             .plusCountries(countriesBuilder -> countriesBuilder)
             .plusCurrencies(currenciesBuilder -> currenciesBuilder)
             .plusLanguages(languagesBuilder -> languagesBuilder)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .messages(messagesBuilder -> messagesBuilder)
             .carts(cartsBuilder -> cartsBuilder)
             .inventory(inventoryBuilder -> inventoryBuilder)
             .discounts(discountsBuilder -> discountsBuilder)
             .build()
 
  • Constructor Details

    • ProjectBuilder

      public ProjectBuilder()
  • Method Details

    • version

      public ProjectBuilder version(Long version)

      Current version of the Project.

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

      public ProjectBuilder key(String key)

      User-defined unique identifier of the Project.

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

      public ProjectBuilder name(String name)

      Name of the Project.

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

      public ProjectBuilder countries(String... countries)

      Country code of the geographic location.

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

      public ProjectBuilder countries(List<String> countries)

      Country code of the geographic location.

      Parameters:
      countries - value to be set
      Returns:
      Builder
    • plusCountries

      public ProjectBuilder plusCountries(String... countries)

      Country code of the geographic location.

      Parameters:
      countries - value to be set
      Returns:
      Builder
    • currencies

      public ProjectBuilder currencies(String... currencies)

      Currency code of the country. A Project must have at least one currency.

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

      public ProjectBuilder currencies(List<String> currencies)

      Currency code of the country. A Project must have at least one currency.

      Parameters:
      currencies - value to be set
      Returns:
      Builder
    • plusCurrencies

      public ProjectBuilder plusCurrencies(String... currencies)

      Currency code of the country. A Project must have at least one currency.

      Parameters:
      currencies - value to be set
      Returns:
      Builder
    • languages

      public ProjectBuilder languages(String... languages)

      Language of the country. A Project must have at least one language.

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

      public ProjectBuilder languages(List<String> languages)

      Language of the country. A Project must have at least one language.

      Parameters:
      languages - value to be set
      Returns:
      Builder
    • plusLanguages

      public ProjectBuilder plusLanguages(String... languages)

      Language of the country. A Project must have at least one language.

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

      public ProjectBuilder createdAt(ZonedDateTime createdAt)

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

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

      public ProjectBuilder trialUntil(@Nullable String trialUntil)

      Date in YYYY-MM format specifying when the trial period for the Project ends. Only present on Projects in trial period.

      Parameters:
      trialUntil - value to be set
      Returns:
      Builder
    • messages

      Holds the configuration for the Messages Query feature.

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

      Holds the configuration for the Messages Query feature.

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

      public ProjectBuilder messages(MessagesConfiguration messages)

      Holds the configuration for the Messages Query feature.

      Parameters:
      messages - value to be set
      Returns:
      Builder
    • carts

      Holds the configuration for the Carts feature.

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

      Holds the configuration for the Carts feature.

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

      public ProjectBuilder carts(CartsConfiguration carts)

      Holds the configuration for the Carts feature.

      Parameters:
      carts - value to be set
      Returns:
      Builder
    • shoppingLists

      Holds the configuration for the Shopping Lists feature.

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

      Holds the configuration for the Shopping Lists feature.

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

      public ProjectBuilder shoppingLists(@Nullable ShoppingListsConfiguration shoppingLists)

      Holds the configuration for the Shopping Lists feature.

      Parameters:
      shoppingLists - value to be set
      Returns:
      Builder
    • shippingRateInputType

      public ProjectBuilder shippingRateInputType(@Nullable ShippingRateInputType shippingRateInputType)

      Holds the configuration for the tiered shipping rates feature.

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

      public ProjectBuilder shippingRateInputType(Function<ShippingRateInputTypeBuilder,Builder<? extends ShippingRateInputType>> builder)

      Holds the configuration for the tiered shipping rates feature.

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

      Represents a RFC 7662 compliant OAuth 2.0 Token Introspection endpoint.

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

      public ProjectBuilder withExternalOAuth(Function<ExternalOAuthBuilder,ExternalOAuth> builder)

      Represents a RFC 7662 compliant OAuth 2.0 Token Introspection endpoint.

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

      public ProjectBuilder externalOAuth(@Nullable ExternalOAuth externalOAuth)

      Represents a RFC 7662 compliant OAuth 2.0 Token Introspection endpoint.

      Parameters:
      externalOAuth - value to be set
      Returns:
      Builder
    • searchIndexing

      Controls indexing of resources to be provided on high performance read-only search endpoints.

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

      Controls indexing of resources to be provided on high performance read-only search endpoints.

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

      public ProjectBuilder searchIndexing(@Nullable SearchIndexingConfiguration searchIndexing)

      Controls indexing of resources to be provided on high performance read-only search endpoints.

      Parameters:
      searchIndexing - value to be set
      Returns:
      Builder
    • businessUnits

      Holds configuration specific to Business Units.

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

      Holds configuration specific to Business Units.

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

      public ProjectBuilder businessUnits(@Nullable BusinessUnitConfiguration businessUnits)

      Holds configuration specific to Business Units.

      Parameters:
      businessUnits - value to be set
      Returns:
      Builder
    • inventory

      Holds configuration specific to inventory.

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

      Holds configuration specific to inventory.

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

      public ProjectBuilder inventory(InventoryConfiguration inventory)

      Holds configuration specific to inventory.

      Parameters:
      inventory - value to be set
      Returns:
      Builder
    • discounts

      Holds configuration specific to discounts, including how Product and Cart Discounts are combined in every Cart of the Project.

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

      Holds configuration specific to discounts, including how Product and Cart Discounts are combined in every Cart of the Project.

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

      public ProjectBuilder discounts(DiscountsConfiguration discounts)

      Holds configuration specific to discounts, including how Product and Cart Discounts are combined in every Cart of the Project.

      Parameters:
      discounts - value to be set
      Returns:
      Builder
    • productCatalogModel

      public ProjectBuilder productCatalogModel(@Nullable ProductCatalogModel productCatalogModel)

      Determines how Product Variants are managed in the Project.

      The x-catalog-model request header can override the effective Catalog model for a single request to resources that resolve Variant data, such as Carts, Orders, and Shopping Lists, independent of the Project's configured Catalog model. Use it during migration to test Modular Catalog behavior on selected requests before changing the Project's configured Catalog model. It is intended as a migration aid, not as a permanent substitute for the Project configuration. It has no effect on Product update actions.

      Parameters:
      productCatalogModel - value to be set
      Returns:
      Builder
    • getVersion

      public Long getVersion()

      Current version of the Project.

      Returns:
      version
    • getKey

      public String getKey()

      User-defined unique identifier of the Project.

      Returns:
      key
    • getName

      public String getName()

      Name of the Project.

      Returns:
      name
    • getCountries

      public List<String> getCountries()

      Country code of the geographic location.

      Returns:
      countries
    • getCurrencies

      public List<String> getCurrencies()

      Currency code of the country. A Project must have at least one currency.

      Returns:
      currencies
    • getLanguages

      public List<String> getLanguages()

      Language of the country. A Project must have at least one language.

      Returns:
      languages
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

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

      Returns:
      createdAt
    • getTrialUntil

      @Nullable public String getTrialUntil()

      Date in YYYY-MM format specifying when the trial period for the Project ends. Only present on Projects in trial period.

      Returns:
      trialUntil
    • getMessages

      public MessagesConfiguration getMessages()

      Holds the configuration for the Messages Query feature.

      Returns:
      messages
    • getCarts

      public CartsConfiguration getCarts()

      Holds the configuration for the Carts feature.

      Returns:
      carts
    • getShoppingLists

      @Nullable public ShoppingListsConfiguration getShoppingLists()

      Holds the configuration for the Shopping Lists feature.

      Returns:
      shoppingLists
    • getShippingRateInputType

      @Nullable public ShippingRateInputType getShippingRateInputType()

      Holds the configuration for the tiered shipping rates feature.

      Returns:
      shippingRateInputType
    • getExternalOAuth

      @Nullable public ExternalOAuth getExternalOAuth()

      Represents a RFC 7662 compliant OAuth 2.0 Token Introspection endpoint.

      Returns:
      externalOAuth
    • getSearchIndexing

      @Nullable public SearchIndexingConfiguration getSearchIndexing()

      Controls indexing of resources to be provided on high performance read-only search endpoints.

      Returns:
      searchIndexing
    • getBusinessUnits

      @Nullable public BusinessUnitConfiguration getBusinessUnits()

      Holds configuration specific to Business Units.

      Returns:
      businessUnits
    • getInventory

      public InventoryConfiguration getInventory()

      Holds configuration specific to inventory.

      Returns:
      inventory
    • getDiscounts

      public DiscountsConfiguration getDiscounts()

      Holds configuration specific to discounts, including how Product and Cart Discounts are combined in every Cart of the Project.

      Returns:
      discounts
    • getProductCatalogModel

      @Nullable public ProductCatalogModel getProductCatalogModel()

      Determines how Product Variants are managed in the Project.

      The x-catalog-model request header can override the effective Catalog model for a single request to resources that resolve Variant data, such as Carts, Orders, and Shopping Lists, independent of the Project's configured Catalog model. Use it during migration to test Modular Catalog behavior on selected requests before changing the Project's configured Catalog model. It is intended as a migration aid, not as a permanent substitute for the Project configuration. It has no effect on Product update actions.

      Returns:
      productCatalogModel
    • build

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

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

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

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