Class ShippingRateBuilder
java.lang.Object
com.commercetools.history.models.common.ShippingRateBuilder
- All Implemented Interfaces:
Builder<ShippingRate>
ShippingRateBuilder
Example to create an instance using the builder pattern
Example to create an instance using the builder pattern
ShippingRate shippingRate = ShippingRate.builder()
.price(priceBuilder -> priceBuilder)
.freeAbove(freeAboveBuilder -> freeAboveBuilder)
.isMatching(true)
.plusTiers(tiersBuilder -> tiersBuilder)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd the value to the tiers using the builder functionbuild()
builds ShippingRate with checking for non-null required valuesbuilds ShippingRate without checking for non-null required valuesset the value to the freeAbovefreeAbove
(Function<MoneyBuilder, MoneyBuilder> builder) set the value to the freeAbove using the builder functionvalue of freeAbove}Only appears in response to requests for ShippingMethods by Cart or location to mark this shipping rate as one that matches the Cart or location.getPrice()
value of price}getTiers()
value of tiers}isMatching
(Boolean isMatching) Only appears in response to requests for ShippingMethods by Cart or location to mark this shipping rate as one that matches the Cart or location.static ShippingRateBuilder
of()
factory method for an instance of ShippingRateBuilderstatic ShippingRateBuilder
of
(ShippingRate template) create builder for ShippingRate instanceplusTiers
(ShippingRatePriceTier... tiers) add values to the tiersadd the value to the tiers using the builder functionset the value to the priceprice
(Function<MoneyBuilder, MoneyBuilder> builder) set the value to the price using the builder functionset the value to the tiers using the builder functiontiers
(ShippingRatePriceTier... tiers) set values to the tierstiers
(List<ShippingRatePriceTier> tiers) set value to the tierswithFreeAbove
(Function<MoneyBuilder, Money> builder) set the value to the freeAbove using the builder functionwithPrice
(Function<MoneyBuilder, Money> builder) set the value to the price using the builder functionset the value to the tiers using the builder function
-
Constructor Details
-
ShippingRateBuilder
public ShippingRateBuilder()
-
-
Method Details
-
price
set the value to the price using the builder function- Parameters:
builder
- function to build the price value- Returns:
- Builder
-
withPrice
set the value to the price using the builder function- Parameters:
builder
- function to build the price value- Returns:
- Builder
-
price
set the value to the price- Parameters:
price
- value to be set- Returns:
- Builder
-
freeAbove
set the value to the freeAbove using the builder function- Parameters:
builder
- function to build the freeAbove value- Returns:
- Builder
-
withFreeAbove
set the value to the freeAbove using the builder function- Parameters:
builder
- function to build the freeAbove value- Returns:
- Builder
-
freeAbove
set the value to the freeAbove- Parameters:
freeAbove
- value to be set- Returns:
- Builder
-
isMatching
Only appears in response to requests for ShippingMethods by Cart or location to mark this shipping rate as one that matches the Cart or location.
- Parameters:
isMatching
- value to be set- Returns:
- Builder
-
tiers
set values to the tiers- Parameters:
tiers
- value to be set- Returns:
- Builder
-
tiers
set value to the tiers- Parameters:
tiers
- value to be set- Returns:
- Builder
-
plusTiers
add values to the tiers- Parameters:
tiers
- value to be set- Returns:
- Builder
-
plusTiers
public ShippingRateBuilder plusTiers(Function<ShippingRatePriceTierBuilder, ShippingRatePriceTierBuilder> builder) add the value to the tiers using the builder function- Parameters:
builder
- function to build the tiers value- Returns:
- Builder
-
withTiers
public ShippingRateBuilder withTiers(Function<ShippingRatePriceTierBuilder, ShippingRatePriceTierBuilder> builder) set the value to the tiers using the builder function- Parameters:
builder
- function to build the tiers value- Returns:
- Builder
-
addTiers
public ShippingRateBuilder addTiers(Function<ShippingRatePriceTierBuilder, ShippingRatePriceTier> builder) add the value to the tiers using the builder function- Parameters:
builder
- function to build the tiers value- Returns:
- Builder
-
setTiers
public ShippingRateBuilder setTiers(Function<ShippingRatePriceTierBuilder, ShippingRatePriceTier> builder) set the value to the tiers using the builder function- Parameters:
builder
- function to build the tiers value- Returns:
- Builder
-
getPrice
value of price}- Returns:
- price
-
getFreeAbove
value of freeAbove}- Returns:
- freeAbove
-
getIsMatching
Only appears in response to requests for ShippingMethods by Cart or location to mark this shipping rate as one that matches the Cart or location.
- Returns:
- isMatching
-
getTiers
value of tiers}- Returns:
- tiers
-
build
builds ShippingRate with checking for non-null required values- Specified by:
build
in interfaceBuilder<ShippingRate>
- Returns:
- ShippingRate
-
buildUnchecked
builds ShippingRate without checking for non-null required values- Returns:
- ShippingRate
-
of
factory method for an instance of ShippingRateBuilder- Returns:
- builder
-
of
create builder for ShippingRate instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-