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 maximum value is 10000 ms (10 seconds) for payment Extensions and 2000 ms (2 seconds) for all other Extensions.

      Parameters:
      timeoutInMs - 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 maximum value is 10000 ms (10 seconds) for payment Extensions and 2000 ms (2 seconds) for all other Extensions.

      Returns:
      timeoutInMs
    • 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