Class CartDiscountValueRelativeDraftBuilder
java.lang.Object
com.commercetools.api.models.cart_discount.CartDiscountValueRelativeDraftBuilder
- All Implemented Interfaces:
Builder<CartDiscountValueRelativeDraft>
public class CartDiscountValueRelativeDraftBuilder
extends Object
implements Builder<CartDiscountValueRelativeDraft>
CartDiscountValueRelativeDraftBuilder
Example to create an instance using the builder pattern
Example to create an instance using the builder pattern
CartDiscountValueRelativeDraft cartDiscountValueRelativeDraft = CartDiscountValueRelativeDraft.builder()
.permyriad(0.3)
.build()
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplicationMode(DiscountApplicationMode applicationMode) Determines how the discount applies when using CartDiscountPatternTarget.build()builds CartDiscountValueRelativeDraft with checking for non-null required valuesbuilds CartDiscountValueRelativeDraft without checking for non-null required valuesDetermines how the discount applies when using CartDiscountPatternTarget.Fraction (per ten thousand) the price is reduced by.of()factory method for an instance of CartDiscountValueRelativeDraftBuilderof(CartDiscountValueRelativeDraft template) create builder for CartDiscountValueRelativeDraft instanceFraction (per ten thousand) the price is reduced by.
-
Constructor Details
-
CartDiscountValueRelativeDraftBuilder
public CartDiscountValueRelativeDraftBuilder()
-
-
Method Details
-
permyriad
Fraction (per ten thousand) the price is reduced by. For example,
1000will result in a 10% price reduction.- Parameters:
permyriad- value to be set- Returns:
- Builder
-
applicationMode
public CartDiscountValueRelativeDraftBuilder applicationMode(@Nullable DiscountApplicationMode applicationMode) Determines how the discount applies when using CartDiscountPatternTarget.
- If the mode is
IndividualApplication, the discounted percentage is applied on each unit's price. The units matching thetriggerPatternare not considered. - If the mode is
ProportionateDistributionandEvenDistributionthe discounted value is calculated from the total value of the units matching thetargetPatternand distributed among the units matching thetargetPatternortriggerPattern. These modes are allowed only if CartDiscountPatternTargettriggerPatternis non-empty.
- Parameters:
applicationMode- value to be set- Returns:
- Builder
- If the mode is
-
getPermyriad
Fraction (per ten thousand) the price is reduced by. For example,
1000will result in a 10% price reduction.- Returns:
- permyriad
-
getApplicationMode
Determines how the discount applies when using CartDiscountPatternTarget.
- If the mode is
IndividualApplication, the discounted percentage is applied on each unit's price. The units matching thetriggerPatternare not considered. - If the mode is
ProportionateDistributionandEvenDistributionthe discounted value is calculated from the total value of the units matching thetargetPatternand distributed among the units matching thetargetPatternortriggerPattern. These modes are allowed only if CartDiscountPatternTargettriggerPatternis non-empty.
- Returns:
- applicationMode
- If the mode is
-
build
builds CartDiscountValueRelativeDraft with checking for non-null required values- Specified by:
buildin interfaceBuilder<CartDiscountValueRelativeDraft>- Returns:
- CartDiscountValueRelativeDraft
-
buildUnchecked
builds CartDiscountValueRelativeDraft without checking for non-null required values- Returns:
- CartDiscountValueRelativeDraft
-
of
factory method for an instance of CartDiscountValueRelativeDraftBuilder- Returns:
- builder
-
of
create builder for CartDiscountValueRelativeDraft instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-