Class DirectDiscountDraftBuilder
java.lang.Object
com.commercetools.api.models.cart.DirectDiscountDraftBuilder
- All Implemented Interfaces:
Builder<DirectDiscountDraft>
DirectDiscountDraftBuilder
Example to create an instance using the builder pattern
Example to create an instance using the builder pattern
DirectDiscountDraft directDiscountDraft = DirectDiscountDraft.builder()
.value(valueBuilder -> valueBuilder)
.build()
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()builds DirectDiscountDraft with checking for non-null required valuesbuilds DirectDiscountDraft without checking for non-null required valuesIf set totrue, Direct Discounts compete against Product Discounts to apply the best deal. If set tofalse, Direct Discounts are ignored when calculating the best deal comparison, and are applied on top of the discount type that offers the best deal.Defines what segment of the Cart will be discounted.getValue()Defines the effect the Discount will have.static DirectDiscountDraftBuilderof()factory method for an instance of DirectDiscountDraftBuilderstatic DirectDiscountDraftBuilderof(DirectDiscountDraft template) create builder for DirectDiscountDraft instanceparticipateInBestDealSelection(Boolean participateInBestDealSelection) If set totrue, Direct Discounts compete against Product Discounts to apply the best deal. If set tofalse, 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) Defines what segment of the Cart will be discounted.target(Function<CartDiscountTargetBuilder, Builder<? extends CartDiscountTarget>> builder) Defines what segment of the Cart will be discounted.value(CartDiscountValueDraft value) Defines the effect the Discount will have.value(Function<CartDiscountValueDraftBuilder, Builder<? extends CartDiscountValueDraft>> builder) Defines the effect the Discount will have.
-
Constructor Details
-
DirectDiscountDraftBuilder
public DirectDiscountDraftBuilder()
-
-
Method Details
-
value
Defines the effect the Discount will have.
- Parameters:
value- value to be set- Returns:
- Builder
-
value
public DirectDiscountDraftBuilder value(Function<CartDiscountValueDraftBuilder, Builder<? extends CartDiscountValueDraft>> builder) Defines the effect the Discount will have.
- Parameters:
builder- function to build the value value- Returns:
- Builder
-
target
Defines what segment of the Cart will be discounted.
If
valueis set togiftLineItem, this must not be set.- Parameters:
target- value to be set- Returns:
- Builder
-
target
public DirectDiscountDraftBuilder target(Function<CartDiscountTargetBuilder, Builder<? extends CartDiscountTarget>> builder) Defines what segment of the Cart will be discounted.
If
valueis set togiftLineItem, this must not be set.- Parameters:
builder- function to build the target value- Returns:
- Builder
-
participateInBestDealSelection
public DirectDiscountDraftBuilder participateInBestDealSelection(@Nullable Boolean participateInBestDealSelection) - If set to
true, Direct Discounts compete against Product Discounts to apply the best deal. - If set to
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 set to
-
getValue
Defines the effect the Discount will have.
- Returns:
- value
-
getTarget
Defines what segment of the Cart will be discounted.
If
valueis set togiftLineItem, this must not be set.- Returns:
- target
-
getParticipateInBestDealSelection
- If set to
true, Direct Discounts compete against Product Discounts to apply the best deal. - If set to
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 set to
-
build
builds DirectDiscountDraft with checking for non-null required values- Specified by:
buildin interfaceBuilder<DirectDiscountDraft>- Returns:
- DirectDiscountDraft
-
buildUnchecked
builds DirectDiscountDraft without checking for non-null required values- Returns:
- DirectDiscountDraft
-
of
factory method for an instance of DirectDiscountDraftBuilder- Returns:
- builder
-
of
create builder for DirectDiscountDraft instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-