Class CountOnLineItemUnitsBuilder

java.lang.Object
com.commercetools.api.models.cart_discount.CountOnLineItemUnitsBuilder
All Implemented Interfaces:
Builder<CountOnLineItemUnits>

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

     CountOnLineItemUnits countOnLineItemUnits = CountOnLineItemUnits.builder()
             .predicate("{predicate}")
             .build()
 
  • Constructor Details

    • CountOnLineItemUnitsBuilder

      public CountOnLineItemUnitsBuilder()
  • Method Details

    • predicate

      public CountOnLineItemUnitsBuilder predicate(String predicate)

      Valid LineItem predicate that determines the units participating in the Discount.

      Parameters:
      predicate - value to be set
      Returns:
      Builder
    • minCount

      public CountOnLineItemUnitsBuilder minCount(@Nullable Integer minCount)

      Minimum number of units of a Line Item that match the predicate.

      Parameters:
      minCount - value to be set
      Returns:
      Builder
    • maxCount

      public CountOnLineItemUnitsBuilder maxCount(@Nullable Integer maxCount)

      Maximum number of units of a Line Item that match the predicate. There might be more units matching the predicate, but they will not be participating to the resulting set.

      The value must be greater than or equal to minCount. If not provided, the component will match all units that satisfy the predicate.

      Parameters:
      maxCount - value to be set
      Returns:
      Builder
    • excludeCount

      public CountOnLineItemUnitsBuilder excludeCount(@Nullable Integer excludeCount)

      Number of units of a Line Item to exclude on every application of the Discount.

      Set only when configuring the targetPattern.

      The units matched first (satisfying the pattern component) will be excluded from the resulting set. The minCountand maxCount are considered only after the exclusion. Pattern components are matched only if any further units satisfying the pattern component exist. For example, if 5 jeans are required but only 3 should be discounted, the excludeCount value must be 2.

      Parameters:
      excludeCount - value to be set
      Returns:
      Builder
    • getPredicate

      public String getPredicate()

      Valid LineItem predicate that determines the units participating in the Discount.

      Returns:
      predicate
    • getMinCount

      @Nullable public Integer getMinCount()

      Minimum number of units of a Line Item that match the predicate.

      Returns:
      minCount
    • getMaxCount

      @Nullable public Integer getMaxCount()

      Maximum number of units of a Line Item that match the predicate. There might be more units matching the predicate, but they will not be participating to the resulting set.

      The value must be greater than or equal to minCount. If not provided, the component will match all units that satisfy the predicate.

      Returns:
      maxCount
    • getExcludeCount

      @Nullable public Integer getExcludeCount()

      Number of units of a Line Item to exclude on every application of the Discount.

      Set only when configuring the targetPattern.

      The units matched first (satisfying the pattern component) will be excluded from the resulting set. The minCountand maxCount are considered only after the exclusion. Pattern components are matched only if any further units satisfying the pattern component exist. For example, if 5 jeans are required but only 3 should be discounted, the excludeCount value must be 2.

      Returns:
      excludeCount
    • build

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

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

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

      create builder for CountOnLineItemUnits instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder