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
-
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.Segment of the Cart that is discounted.getValue()
Effect of the Discount on the Cart.Unique identifier of the Direct Discount.static DirectDiscountBuilder
of()
factory method for an instance of DirectDiscountBuilderstatic DirectDiscountBuilder
of
(DirectDiscount template) create builder for DirectDiscount instancetarget
(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.
Empty when the
value
is set togiftLineItem
.- 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.
Empty when the
value
is set togiftLineItem
.- Parameters:
builder
- function to build the target value- Returns:
- Builder
-
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.
Empty when the
value
is set togiftLineItem
.- Returns:
- target
-
build
builds DirectDiscount with checking for non-null required values- Specified by:
build
in 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
-