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
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
builds DirectDiscountDraft with checking for non-null required valuesbuilds DirectDiscountDraft without checking for non-null required valuesDefines what segment of the Cart will be discounted.getValue()
Defines the effect the Discount will have.static DirectDiscountDraftBuilder
of()
factory method for an instance of DirectDiscountDraftBuilderstatic DirectDiscountDraftBuilder
of
(DirectDiscountDraft template) create builder for DirectDiscountDraft instancetarget
(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
value
is 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
value
is set togiftLineItem
, this must not be set.- Parameters:
builder
- function to build the target value- Returns:
- Builder
-
getValue
Defines the effect the Discount will have.
- Returns:
- value
-
getTarget
Defines what segment of the Cart will be discounted.
If
value
is set togiftLineItem
, this must not be set.- Returns:
- target
-
build
builds DirectDiscountDraft with checking for non-null required values- Specified by:
build
in 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
-