Class ShippingRateBuilder
- All Implemented Interfaces:
Builder<ShippingRate>
Example to create an instance using the builder pattern
ShippingRate shippingRate = ShippingRate.builder()
.price(priceBuilder -> priceBuilder)
.plusTiers(tiersBuilder -> tiersBuilder)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
builds ShippingRate with checking for non-null required valuesbuilds ShippingRate without checking for non-null required valuesfreeAbove
(CentPrecisionMoney freeAbove) Free shipping is applied if the sum of the (Custom) Line Item Prices reaches the specified value.Free shipping is applied if the sum of the (Custom) Line Item Prices reaches the specified value.Free shipping is applied if the sum of the (Custom) Line Item Prices reaches the specified value.true
if the ShippingRate matches given Cart or Location.getPrice()
Currency amount of the ShippingRate.getTiers()
Price tiers for the ShippingRate.isMatching
(Boolean isMatching) true
if the ShippingRate matches given Cart or Location.static ShippingRateBuilder
of()
factory method for an instance of ShippingRateBuilderstatic ShippingRateBuilder
of
(ShippingRate template) create builder for ShippingRate instanceplusTiers
(ShippingRatePriceTier... tiers) Price tiers for the ShippingRate.plusTiers
(Function<ShippingRatePriceTierBuilder, Builder<? extends ShippingRatePriceTier>> builder) Price tiers for the ShippingRate.price
(CentPrecisionMoney price) Currency amount of the ShippingRate.Currency amount of the ShippingRate.tiers
(ShippingRatePriceTier... tiers) Price tiers for the ShippingRate.tiers
(List<ShippingRatePriceTier> tiers) Price tiers for the ShippingRate.Free shipping is applied if the sum of the (Custom) Line Item Prices reaches the specified value.Currency amount of the ShippingRate.withTiers
(Function<ShippingRatePriceTierBuilder, Builder<? extends ShippingRatePriceTier>> builder) Price tiers for the ShippingRate.
-
Constructor Details
-
ShippingRateBuilder
public ShippingRateBuilder()
-
-
Method Details
-
price
public ShippingRateBuilder price(Function<CentPrecisionMoneyBuilder, CentPrecisionMoneyBuilder> builder) Currency amount of the ShippingRate.
- Parameters:
builder
- function to build the price value- Returns:
- Builder
-
withPrice
public ShippingRateBuilder withPrice(Function<CentPrecisionMoneyBuilder, CentPrecisionMoney> builder) Currency amount of the ShippingRate.
- Parameters:
builder
- function to build the price value- Returns:
- Builder
-
price
Currency amount of the ShippingRate.
- Parameters:
price
- value to be set- Returns:
- Builder
-
freeAbove
public ShippingRateBuilder freeAbove(Function<CentPrecisionMoneyBuilder, CentPrecisionMoneyBuilder> builder) Free shipping is applied if the sum of the (Custom) Line Item Prices reaches the specified value.
- Parameters:
builder
- function to build the freeAbove value- Returns:
- Builder
-
withFreeAbove
public ShippingRateBuilder withFreeAbove(Function<CentPrecisionMoneyBuilder, CentPrecisionMoney> builder) Free shipping is applied if the sum of the (Custom) Line Item Prices reaches the specified value.
- Parameters:
builder
- function to build the freeAbove value- Returns:
- Builder
-
freeAbove
Free shipping is applied if the sum of the (Custom) Line Item Prices reaches the specified value.
- Parameters:
freeAbove
- value to be set- Returns:
- Builder
-
isMatching
true
if the ShippingRate matches given Cart or Location. Only appears in response to requests for Get ShippingMethods for a Cart or Get ShippingMethods for a Location.- Parameters:
isMatching
- value to be set- Returns:
- Builder
-
tiers
Price tiers for the ShippingRate.
- Parameters:
tiers
- value to be set- Returns:
- Builder
-
tiers
Price tiers for the ShippingRate.
- Parameters:
tiers
- value to be set- Returns:
- Builder
-
plusTiers
Price tiers for the ShippingRate.
- Parameters:
tiers
- value to be set- Returns:
- Builder
-
plusTiers
public ShippingRateBuilder plusTiers(Function<ShippingRatePriceTierBuilder, Builder<? extends ShippingRatePriceTier>> builder) Price tiers for the ShippingRate.
- Parameters:
builder
- function to build the tiers value- Returns:
- Builder
-
withTiers
public ShippingRateBuilder withTiers(Function<ShippingRatePriceTierBuilder, Builder<? extends ShippingRatePriceTier>> builder) Price tiers for the ShippingRate.
- Parameters:
builder
- function to build the tiers value- Returns:
- Builder
-
getPrice
Currency amount of the ShippingRate.
- Returns:
- price
-
getFreeAbove
Free shipping is applied if the sum of the (Custom) Line Item Prices reaches the specified value.
- Returns:
- freeAbove
-
getIsMatching
true
if the ShippingRate matches given Cart or Location. Only appears in response to requests for Get ShippingMethods for a Cart or Get ShippingMethods for a Location.- Returns:
- isMatching
-
getTiers
Price tiers for the ShippingRate.
- 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
-