Class DirectDiscountBuilder
java.lang.Object
com.commercetools.api.models.cart.DirectDiscountBuilder
- All Implemented Interfaces:
Builder<DirectDiscount>
DirectDiscountBuilder
Example to create an instance using the builder pattern
Example to create an instance using the builder pattern
DirectDiscount directDiscount = DirectDiscount.builder()
.id("{id}")
.value(valueBuilder -> valueBuilder)
.build()
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()builds DirectDiscount with checking for non-null required valuesbuilds DirectDiscount without checking for non-null required valuesgetId()Unique identifier of the Direct Discount.Iftrue, Direct Discounts compete against Product Discounts to apply the best deal. Iffalse, Direct Discounts are ignored when calculating the best deal comparison, and are applied on top of the discount type that offers the best deal.Segment of the Cart that is discounted.getValue()Effect of the Discount on the Cart.Unique identifier of the Direct Discount.static DirectDiscountBuilderof()factory method for an instance of DirectDiscountBuilderstatic DirectDiscountBuilderof(DirectDiscount template) create builder for DirectDiscount instanceparticipateInBestDealSelection(Boolean participateInBestDealSelection) Iftrue, Direct Discounts compete against Product Discounts to apply the best deal. Iffalse, Direct Discounts are ignored when calculating the best deal comparison, and are applied on top of the discount type that offers the best deal.target(CartDiscountTarget target) Segment of the Cart that is discounted.target(Function<CartDiscountTargetBuilder, Builder<? extends CartDiscountTarget>> builder) Segment of the Cart that is discounted.value(CartDiscountValue value) Effect of the Discount on the Cart.value(Function<CartDiscountValueBuilder, Builder<? extends CartDiscountValue>> builder) Effect of the Discount on the Cart.
-
Constructor Details
-
DirectDiscountBuilder
public DirectDiscountBuilder()
-
-
Method Details
-
id
Unique identifier of the Direct Discount.
- Parameters:
id- value to be set- Returns:
- Builder
-
value
Effect of the Discount on the Cart.
- Parameters:
value- value to be set- Returns:
- Builder
-
value
public DirectDiscountBuilder value(Function<CartDiscountValueBuilder, Builder<? extends CartDiscountValue>> builder) Effect of the Discount on the Cart.
- Parameters:
builder- function to build the value value- Returns:
- Builder
-
target
Segment of the Cart that is discounted.
Absent if the
valueisgiftLineItem.- Parameters:
target- value to be set- Returns:
- Builder
-
target
public DirectDiscountBuilder target(Function<CartDiscountTargetBuilder, Builder<? extends CartDiscountTarget>> builder) Segment of the Cart that is discounted.
Absent if the
valueisgiftLineItem.- Parameters:
builder- function to build the target value- Returns:
- Builder
-
participateInBestDealSelection
public DirectDiscountBuilder participateInBestDealSelection(@Nullable Boolean participateInBestDealSelection) - If
true, Direct Discounts compete against Product Discounts to apply the best deal. - If
false, Direct Discounts are ignored when calculating the best deal comparison, and are applied on top of the discount type that offers the best deal.
This applies only when the DiscountCombinationMode for the Project is
BestDeal.- Parameters:
participateInBestDealSelection- value to be set- Returns:
- Builder
- If
-
getId
Unique identifier of the Direct Discount.
- Returns:
- id
-
getValue
Effect of the Discount on the Cart.
- Returns:
- value
-
getTarget
Segment of the Cart that is discounted.
Absent if the
valueisgiftLineItem.- Returns:
- target
-
getParticipateInBestDealSelection
- If
true, Direct Discounts compete against Product Discounts to apply the best deal. - If
false, Direct Discounts are ignored when calculating the best deal comparison, and are applied on top of the discount type that offers the best deal.
This applies only when the DiscountCombinationMode for the Project is
BestDeal.- Returns:
- participateInBestDealSelection
- If
-
build
builds DirectDiscount with checking for non-null required values- Specified by:
buildin interfaceBuilder<DirectDiscount>- Returns:
- DirectDiscount
-
buildUnchecked
builds DirectDiscount without checking for non-null required values- Returns:
- DirectDiscount
-
of
factory method for an instance of DirectDiscountBuilder- Returns:
- builder
-
of
create builder for DirectDiscount instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-