Class PriceTierDraftBuilder
- All Implemented Interfaces:
Builder<PriceTierDraft>
Example to create an instance using the builder pattern
PriceTierDraft priceTierDraft = PriceTierDraft.builder()
.minimumQuantity(0.3)
.value(valueBuilder -> valueBuilder)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
builds PriceTierDraft with checking for non-null required valuesbuilds PriceTierDraft without checking for non-null required valuesMinimum quantity this Price tier is valid for.getValue()
Money value that applies when theminimumQuantity
is greater than or equal to the LineItemquantity
.minimumQuantity
(Long minimumQuantity) Minimum quantity this Price tier is valid for.static PriceTierDraftBuilder
of()
factory method for an instance of PriceTierDraftBuilderstatic PriceTierDraftBuilder
of
(PriceTierDraft template) create builder for PriceTierDraft instanceMoney value that applies when theminimumQuantity
is greater than or equal to the LineItemquantity
.value
(Function<MoneyBuilder, MoneyBuilder> builder) Money value that applies when theminimumQuantity
is greater than or equal to the LineItemquantity
.withValue
(Function<MoneyBuilder, Money> builder) Money value that applies when theminimumQuantity
is greater than or equal to the LineItemquantity
.
-
Constructor Details
-
PriceTierDraftBuilder
public PriceTierDraftBuilder()
-
-
Method Details
-
minimumQuantity
Minimum quantity this Price tier is valid for.
The minimum quantity is always greater than or equal to 2. The base Price is interpreted as valid for a minimum quantity equal to 1. A Price or StandalonePrice cannot contain more than one tier with the same
minimumQuantity
. In the case one of the constraint is not met an InvalidField is returned.- Parameters:
minimumQuantity
- value to be set- Returns:
- Builder
-
value
Money value that applies when the
minimumQuantity
is greater than or equal to the LineItemquantity
.The
currencyCode
of a Price tier must be the same as thecurrencyCode
in thevalue
of the related Price.- Parameters:
builder
- function to build the value value- Returns:
- Builder
-
withValue
Money value that applies when the
minimumQuantity
is greater than or equal to the LineItemquantity
.The
currencyCode
of a Price tier must be the same as thecurrencyCode
in thevalue
of the related Price.- Parameters:
builder
- function to build the value value- Returns:
- Builder
-
value
Money value that applies when the
minimumQuantity
is greater than or equal to the LineItemquantity
.The
currencyCode
of a Price tier must be the same as thecurrencyCode
in thevalue
of the related Price.- Parameters:
value
- value to be set- Returns:
- Builder
-
getMinimumQuantity
Minimum quantity this Price tier is valid for.
The minimum quantity is always greater than or equal to 2. The base Price is interpreted as valid for a minimum quantity equal to 1. A Price or StandalonePrice cannot contain more than one tier with the same
minimumQuantity
. In the case one of the constraint is not met an InvalidField is returned.- Returns:
- minimumQuantity
-
getValue
Money value that applies when the
minimumQuantity
is greater than or equal to the LineItemquantity
.The
currencyCode
of a Price tier must be the same as thecurrencyCode
in thevalue
of the related Price.- Returns:
- value
-
build
builds PriceTierDraft with checking for non-null required values- Specified by:
build
in interfaceBuilder<PriceTierDraft>
- Returns:
- PriceTierDraft
-
buildUnchecked
builds PriceTierDraft without checking for non-null required values- Returns:
- PriceTierDraft
-
of
factory method for an instance of PriceTierDraftBuilder- Returns:
- builder
-
of
create builder for PriceTierDraft instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-