Class CartDiscountValueRelativeBuilder
java.lang.Object
com.commercetools.api.models.cart_discount.CartDiscountValueRelativeBuilder
- All Implemented Interfaces:
Builder<CartDiscountValueRelative>
public class CartDiscountValueRelativeBuilder
extends Object
implements Builder<CartDiscountValueRelative>
CartDiscountValueRelativeBuilder
Example to create an instance using the builder pattern
Example to create an instance using the builder pattern
CartDiscountValueRelative cartDiscountValueRelative = CartDiscountValueRelative.builder()
.permyriad(0.3)
.build()
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplicationMode(DiscountApplicationMode applicationMode) Indicates how the discount applies when using CartDiscountPatternTarget.build()builds CartDiscountValueRelative with checking for non-null required valuesbuilds CartDiscountValueRelative without checking for non-null required valuesIndicates how the discount applies when using CartDiscountPatternTarget.Fraction (per ten thousand) the price is reduced by.of()factory method for an instance of CartDiscountValueRelativeBuilderof(CartDiscountValueRelative template) create builder for CartDiscountValueRelative instanceFraction (per ten thousand) the price is reduced by.
-
Constructor Details
-
CartDiscountValueRelativeBuilder
public CartDiscountValueRelativeBuilder()
-
-
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 CartDiscountValueRelativeBuilder applicationMode(@Nullable DiscountApplicationMode applicationMode) Indicates 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
Indicates 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 CartDiscountValueRelative with checking for non-null required values- Specified by:
buildin interfaceBuilder<CartDiscountValueRelative>- Returns:
- CartDiscountValueRelative
-
buildUnchecked
builds CartDiscountValueRelative without checking for non-null required values- Returns:
- CartDiscountValueRelative
-
of
factory method for an instance of CartDiscountValueRelativeBuilder- Returns:
- builder
-
of
create builder for CartDiscountValueRelative instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-