Class DiscountedPriceBuilder
java.lang.Object
com.commercetools.api.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
(ProductDiscountReference discount) ProductDiscount related to the discounted price.ProductDiscount related to the discounted price.ProductDiscount related to the discounted price.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.ProductDiscount related to the discounted price.
-
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<ProductDiscountReferenceBuilder, ProductDiscountReferenceBuilder> builder) ProductDiscount related to the discounted price.
- Parameters:
builder
- function to build the discount value- Returns:
- Builder
-
withDiscount
public DiscountedPriceBuilder withDiscount(Function<ProductDiscountReferenceBuilder, ProductDiscountReference> builder) ProductDiscount related to the discounted price.
- Parameters:
builder
- function to build the discount value- Returns:
- Builder
-
discount
ProductDiscount related to the discounted price.
- Parameters:
discount
- value to be set- Returns:
- Builder
-
getValue
Money value of the discounted price.
- Returns:
- value
-
getDiscount
ProductDiscount related to the discounted price.
- 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
-