Class TaxPortionBuilder
java.lang.Object
com.commercetools.api.models.cart.TaxPortionBuilder
- All Implemented Interfaces:
Builder<TaxPortion>
TaxPortionBuilder
Example to create an instance using the builder pattern
Example to create an instance using the builder pattern
TaxPortion taxPortion = TaxPortion.builder()
.rate(0.3)
.amount(amountBuilder -> amountBuilder)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionamount
(CentPrecisionMoney amount) Money value of the tax portion.Money value of the tax portion.build()
builds TaxPortion with checking for non-null required valuesbuilds TaxPortion without checking for non-null required valuesMoney value of the tax portion.getName()
Name of the tax portion.getRate()
A number in the range 0-1.Name of the tax portion.static TaxPortionBuilder
of()
factory method for an instance of TaxPortionBuilderstatic TaxPortionBuilder
of
(TaxPortion template) create builder for TaxPortion instanceA number in the range 0-1.Money value of the tax portion.
-
Constructor Details
-
TaxPortionBuilder
public TaxPortionBuilder()
-
-
Method Details
-
name
Name of the tax portion.
- Parameters:
name
- value to be set- Returns:
- Builder
-
rate
A number in the range 0-1.
- Parameters:
rate
- value to be set- Returns:
- Builder
-
amount
public TaxPortionBuilder amount(Function<CentPrecisionMoneyBuilder, CentPrecisionMoneyBuilder> builder) Money value of the tax portion.
- Parameters:
builder
- function to build the amount value- Returns:
- Builder
-
withAmount
Money value of the tax portion.
- Parameters:
builder
- function to build the amount value- Returns:
- Builder
-
amount
Money value of the tax portion.
- Parameters:
amount
- value to be set- Returns:
- Builder
-
getName
Name of the tax portion.
- Returns:
- name
-
getRate
A number in the range 0-1.
- Returns:
- rate
-
getAmount
Money value of the tax portion.
- Returns:
- amount
-
build
builds TaxPortion with checking for non-null required values- Specified by:
build
in interfaceBuilder<TaxPortion>
- Returns:
- TaxPortion
-
buildUnchecked
builds TaxPortion without checking for non-null required values- Returns:
- TaxPortion
-
of
factory method for an instance of TaxPortionBuilder- Returns:
- builder
-
of
create builder for TaxPortion instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-