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()
Money value of the discounted price.static DiscountedPriceBuilder
of()
factory method for an instance of DiscountedPriceBuilderstatic DiscountedPriceBuilder
of
(DiscountedPrice template) create builder for DiscountedPrice instancevalue
(TypedMoney value) Money value of the discounted price.value
(Function<TypedMoneyBuilder, Builder<? extends TypedMoney>> builder) Money value of the discounted price.Reference to a ProductDiscount.
-
Constructor Details
-
DiscountedPriceBuilder
public DiscountedPriceBuilder()
-
-
Method Details
-
value
Money value of the discounted price.
- Parameters:
value
- value to be set- Returns:
- Builder
-
value
public DiscountedPriceBuilder value(Function<TypedMoneyBuilder, Builder<? extends TypedMoney>> builder) Money value of the discounted price.
- 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
Money value of the discounted price.
- 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
-