Class ExtensionBuilder

java.lang.Object
com.commercetools.api.models.extension.ExtensionBuilder
All Implemented Interfaces:
Builder<Extension>

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

     Extension extension = Extension.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .destination(destinationBuilder -> destinationBuilder)
             .plusTriggers(triggersBuilder -> triggersBuilder)
             .build()
 
  • Constructor Details

    • ExtensionBuilder

      public ExtensionBuilder()
  • Method Details

    • id

      public ExtensionBuilder id(String id)

      Unique identifier of the Extension.

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

      public ExtensionBuilder version(Long version)

      Current version of the Extension.

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

      public ExtensionBuilder createdAt(ZonedDateTime createdAt)

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

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

      public ExtensionBuilder lastModifiedAt(ZonedDateTime lastModifiedAt)

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

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

      IDs and references that last modified the Extension.

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

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

      IDs and references that last modified the Extension.

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

      public ExtensionBuilder lastModifiedBy(@Nullable LastModifiedBy lastModifiedBy)

      IDs and references that last modified the Extension.

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

      IDs and references that created the Extension.

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

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

      IDs and references that created the Extension.

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

      public ExtensionBuilder createdBy(@Nullable CreatedBy createdBy)

      IDs and references that created the Extension.

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

      public ExtensionBuilder key(@Nullable String key)

      User-defined unique identifier of the Extension.

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

      public ExtensionBuilder destination(ExtensionDestination destination)

      The configuration for the Extension, including its type, location and authentication details.

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

      The configuration for the Extension, including its type, location and authentication details.

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

      public ExtensionBuilder triggers(ExtensionTrigger... triggers)

      Describes what triggers the Extension.

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

      public ExtensionBuilder triggers(List<ExtensionTrigger> triggers)

      Describes what triggers the Extension.

      Parameters:
      triggers - value to be set
      Returns:
      Builder
    • plusTriggers

      public ExtensionBuilder plusTriggers(ExtensionTrigger... triggers)

      Describes what triggers the Extension.

      Parameters:
      triggers - value to be set
      Returns:
      Builder
    • plusTriggers

      Describes what triggers the Extension.

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

      Describes what triggers the Extension.

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

      Describes what triggers the Extension.

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

      Describes what triggers the Extension.

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

      public ExtensionBuilder timeoutInMs(@Nullable Integer timeoutInMs)

      Maximum time (in milliseconds) that the Extension can respond within. If no timeout is provided, the default value is used for all types of Extensions.

      The limit of 10000 ms (10 seconds) can be increased per Project after we review the performance impact. Please contact the commercetools support team and provide the Region, Project key, and use case.

      Parameters:
      timeoutInMs - value to be set
      Returns:
      Builder
    • dependencies

      public ExtensionBuilder dependencies(@Nullable ExtensionReference... dependencies)

      References to other Extensions that must complete before this Extension is called. The Extension receives the resource state after all transitive ancestors' update actions have been applied. Maximum 5 entries.

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

      public ExtensionBuilder dependencies(@Nullable List<ExtensionReference> dependencies)

      References to other Extensions that must complete before this Extension is called. The Extension receives the resource state after all transitive ancestors' update actions have been applied. Maximum 5 entries.

      Parameters:
      dependencies - value to be set
      Returns:
      Builder
    • plusDependencies

      public ExtensionBuilder plusDependencies(@Nullable ExtensionReference... dependencies)

      References to other Extensions that must complete before this Extension is called. The Extension receives the resource state after all transitive ancestors' update actions have been applied. Maximum 5 entries.

      Parameters:
      dependencies - value to be set
      Returns:
      Builder
    • plusDependencies

      References to other Extensions that must complete before this Extension is called. The Extension receives the resource state after all transitive ancestors' update actions have been applied. Maximum 5 entries.

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

      References to other Extensions that must complete before this Extension is called. The Extension receives the resource state after all transitive ancestors' update actions have been applied. Maximum 5 entries.

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

      References to other Extensions that must complete before this Extension is called. The Extension receives the resource state after all transitive ancestors' update actions have been applied. Maximum 5 entries.

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

      References to other Extensions that must complete before this Extension is called. The Extension receives the resource state after all transitive ancestors' update actions have been applied. Maximum 5 entries.

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

      public ExtensionBuilder expansionPaths(@Nullable String... expansionPaths)

      Expansion paths used for reference expansion of the payload.

      Be aware of the limits of this feature and its performance impact.

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

      public ExtensionBuilder expansionPaths(@Nullable List<String> expansionPaths)

      Expansion paths used for reference expansion of the payload.

      Be aware of the limits of this feature and its performance impact.

      Parameters:
      expansionPaths - value to be set
      Returns:
      Builder
    • plusExpansionPaths

      public ExtensionBuilder plusExpansionPaths(@Nullable String... expansionPaths)

      Expansion paths used for reference expansion of the payload.

      Be aware of the limits of this feature and its performance impact.

      Parameters:
      expansionPaths - value to be set
      Returns:
      Builder
    • additionalContext

      Configures additional information included in the payload sent to the API Extension.

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

      Configures additional information included in the payload sent to the API Extension.

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

      public ExtensionBuilder additionalContext(@Nullable ExtensionAdditionalContext additionalContext)

      Configures additional information included in the payload sent to the API Extension.

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

      public String getId()

      Unique identifier of the Extension.

      Returns:
      id
    • getVersion

      public Long getVersion()

      Current version of the Extension.

      Returns:
      version
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

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

      Returns:
      createdAt
    • getLastModifiedAt

      public ZonedDateTime getLastModifiedAt()

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

      Returns:
      lastModifiedAt
    • getLastModifiedBy

      @Nullable public LastModifiedBy getLastModifiedBy()

      IDs and references that last modified the Extension.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Nullable public CreatedBy getCreatedBy()

      IDs and references that created the Extension.

      Returns:
      createdBy
    • getKey

      @Nullable public String getKey()

      User-defined unique identifier of the Extension.

      Returns:
      key
    • getDestination

      public ExtensionDestination getDestination()

      The configuration for the Extension, including its type, location and authentication details.

      Returns:
      destination
    • getTriggers

      public List<ExtensionTrigger> getTriggers()

      Describes what triggers the Extension.

      Returns:
      triggers
    • getTimeoutInMs

      @Nullable public Integer getTimeoutInMs()

      Maximum time (in milliseconds) that the Extension can respond within. If no timeout is provided, the default value is used for all types of Extensions.

      The limit of 10000 ms (10 seconds) can be increased per Project after we review the performance impact. Please contact the commercetools support team and provide the Region, Project key, and use case.

      Returns:
      timeoutInMs
    • getDependencies

      @Nullable public List<ExtensionReference> getDependencies()

      References to other Extensions that must complete before this Extension is called. The Extension receives the resource state after all transitive ancestors' update actions have been applied. Maximum 5 entries.

      Returns:
      dependencies
    • getExpansionPaths

      @Nullable public List<String> getExpansionPaths()

      Expansion paths used for reference expansion of the payload.

      Be aware of the limits of this feature and its performance impact.

      Returns:
      expansionPaths
    • getAdditionalContext

      @Nullable public ExtensionAdditionalContext getAdditionalContext()

      Configures additional information included in the payload sent to the API Extension.

      Returns:
      additionalContext
    • build

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

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

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

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