Class DiscountedPriceBuilder
java.lang.Object
com.commercetools.importapi.models.common.DiscountedPriceBuilder
- All Implemented Interfaces:
Builder<DiscountedPrice>
DiscountedPriceBuilder
Example to create an instance using the builder pattern
Example to create an instance using the builder pattern
DiscountedPrice discountedPrice = DiscountedPrice.builder()
.value(valueBuilder -> valueBuilder)
.discount(discountBuilder -> discountBuilder)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
builds DiscountedPrice with checking for non-null required valuesbuilds DiscountedPrice without checking for non-null required valuesdiscount
(ProductDiscountKeyReference discount) Reference to a ProductDiscount.Reference to a ProductDiscount.Reference to a ProductDiscount.getValue()
value of value}static DiscountedPriceBuilder
of()
factory method for an instance of DiscountedPriceBuilderstatic DiscountedPriceBuilder
of
(DiscountedPrice template) create builder for DiscountedPrice instancevalue
(TypedMoney value) set the value to the valuevalue
(Function<TypedMoneyBuilder, Builder<? extends TypedMoney>> builder) set the value to the value using the builder functionReference to a ProductDiscount.
-
Constructor Details
-
DiscountedPriceBuilder
public DiscountedPriceBuilder()
-
-
Method Details
-
value
set the value to the value- Parameters:
value
- value to be set- Returns:
- Builder
-
value
public DiscountedPriceBuilder value(Function<TypedMoneyBuilder, Builder<? extends TypedMoney>> builder) set the value to the value using the builder function- Parameters:
builder
- function to build the value value- Returns:
- Builder
-
discount
public DiscountedPriceBuilder discount(Function<ProductDiscountKeyReferenceBuilder, ProductDiscountKeyReferenceBuilder> builder) Reference to a ProductDiscount.
- Parameters:
builder
- function to build the discount value- Returns:
- Builder
-
withDiscount
public DiscountedPriceBuilder withDiscount(Function<ProductDiscountKeyReferenceBuilder, ProductDiscountKeyReference> builder) Reference to a ProductDiscount.
- Parameters:
builder
- function to build the discount value- Returns:
- Builder
-
discount
Reference to a ProductDiscount.
- Parameters:
discount
- value to be set- Returns:
- Builder
-
getValue
value of value}- Returns:
- value
-
getDiscount
Reference to a ProductDiscount.
- Returns:
- discount
-
build
builds DiscountedPrice with checking for non-null required values- Specified by:
build
in interfaceBuilder<DiscountedPrice>
- Returns:
- DiscountedPrice
-
buildUnchecked
builds DiscountedPrice without checking for non-null required values- Returns:
- DiscountedPrice
-
of
factory method for an instance of DiscountedPriceBuilder- Returns:
- builder
-
of
create builder for DiscountedPrice instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-