Class DiscountGroupBuilder

java.lang.Object
com.commercetools.api.models.discount_group.DiscountGroupBuilder
All Implemented Interfaces:
Builder<DiscountGroup>

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

     DiscountGroup discountGroup = DiscountGroup.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .key("{key}")
             .sortOrder("{sortOrder}")
             .build()
 
  • Constructor Details

    • DiscountGroupBuilder

      public DiscountGroupBuilder()
  • Method Details

    • id

      public DiscountGroupBuilder id(String id)

      Unique identifier of the DiscountGroup.

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

      public DiscountGroupBuilder version(Long version)

      Current version of the DiscountGroup.

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

      public DiscountGroupBuilder createdAt(ZonedDateTime createdAt)

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

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

      public DiscountGroupBuilder lastModifiedAt(ZonedDateTime lastModifiedAt)

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

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

      Name of the DiscountGroup.

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

      Name of the DiscountGroup.

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

      public DiscountGroupBuilder name(@Nullable LocalizedString name)

      Name of the DiscountGroup.

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

      public DiscountGroupBuilder key(String key)

      User-defined unique identifier of the DiscountGroup.

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

      Description of the DiscountGroup.

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

      Description of the DiscountGroup.

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

      public DiscountGroupBuilder description(@Nullable LocalizedString description)

      Description of the DiscountGroup.

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

      public DiscountGroupBuilder sortOrder(String sortOrder)

      Value between 0 and 1 that determines the order in which the CartDiscount from the DiscountGroup is applied; a CartDiscount with a higher value is prioritized.

      The sort order is unique among all DiscountGroups and CartDiscounts.

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

      IDs and references that last modified the DiscountGroup.

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

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

      IDs and references that last modified the DiscountGroup.

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

      public DiscountGroupBuilder lastModifiedBy(@Nullable LastModifiedBy lastModifiedBy)

      IDs and references that last modified the DiscountGroup.

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

      IDs and references that created the DiscountGroup.

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

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

      IDs and references that created the DiscountGroup.

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

      public DiscountGroupBuilder createdBy(@Nullable CreatedBy createdBy)

      IDs and references that created the DiscountGroup.

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

      public String getId()

      Unique identifier of the DiscountGroup.

      Returns:
      id
    • getVersion

      public Long getVersion()

      Current version of the DiscountGroup.

      Returns:
      version
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

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

      Returns:
      createdAt
    • getLastModifiedAt

      public ZonedDateTime getLastModifiedAt()

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

      Returns:
      lastModifiedAt
    • getName

      @Nullable public LocalizedString getName()

      Name of the DiscountGroup.

      Returns:
      name
    • getKey

      public String getKey()

      User-defined unique identifier of the DiscountGroup.

      Returns:
      key
    • getDescription

      @Nullable public LocalizedString getDescription()

      Description of the DiscountGroup.

      Returns:
      description
    • getSortOrder

      public String getSortOrder()

      Value between 0 and 1 that determines the order in which the CartDiscount from the DiscountGroup is applied; a CartDiscount with a higher value is prioritized.

      The sort order is unique among all DiscountGroups and CartDiscounts.

      Returns:
      sortOrder
    • getLastModifiedBy

      @Nullable public LastModifiedBy getLastModifiedBy()

      IDs and references that last modified the DiscountGroup.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Nullable public CreatedBy getCreatedBy()

      IDs and references that created the DiscountGroup.

      Returns:
      createdBy
    • build

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

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

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

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