Class TaxRateBuilder
java.lang.Object
com.commercetools.history.models.common.TaxRateBuilder
TaxRateBuilder
Example to create an instance using the builder pattern
Example to create an instance using the builder pattern
TaxRate taxRate = TaxRate.builder()
.id("{id}")
.name("{name}")
.amount(1)
.includedInPrice(true)
.country("{country}")
.state("{state}")
.plusSubRates(subRatesBuilder -> subRatesBuilder)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddSubRates
(Function<SubRateBuilder, SubRate> builder) add the value to the subRates using the builder functionPercentage in the range of [0..1].build()
builds TaxRate with checking for non-null required valuesbuilds TaxRate without checking for non-null required valuesTwo-digit country code as per ISO 3166-1 alpha-2.Percentage in the range of [0..1].Two-digit country code as per ISO 3166-1 alpha-2.getId()
The ID is always set if the tax rate is part of a TaxCategory.value of includedInPrice}getName()
value of name}getState()
The state in the countryvalue of subRates}The ID is always set if the tax rate is part of a TaxCategory.includedInPrice
(Boolean includedInPrice) set the value to the includedInPriceset the value to the namestatic TaxRateBuilder
of()
factory method for an instance of TaxRateBuilderstatic TaxRateBuilder
create builder for TaxRate instanceplusSubRates
(SubRate... subRates) add values to the subRatesplusSubRates
(Function<SubRateBuilder, SubRateBuilder> builder) add the value to the subRates using the builder functionsetSubRates
(Function<SubRateBuilder, SubRate> builder) set the value to the subRates using the builder functionThe state in the countryset values to the subRatesset value to the subRateswithSubRates
(Function<SubRateBuilder, SubRateBuilder> builder) set the value to the subRates using the builder function
-
Constructor Details
-
TaxRateBuilder
public TaxRateBuilder()
-
-
Method Details
-
id
The ID is always set if the tax rate is part of a TaxCategory. The external tax rates in a Cart do not contain an
id
.- Parameters:
id
- value to be set- Returns:
- Builder
-
name
set the value to the name- Parameters:
name
- value to be set- Returns:
- Builder
-
amount
Percentage in the range of [0..1]. The sum of the amounts of all
subRates
, if there are any.- Parameters:
amount
- value to be set- Returns:
- Builder
-
includedInPrice
set the value to the includedInPrice- Parameters:
includedInPrice
- value to be set- Returns:
- Builder
-
country
Two-digit country code as per ISO 3166-1 alpha-2.
- Parameters:
country
- value to be set- Returns:
- Builder
-
state
The state in the country
- Parameters:
state
- value to be set- Returns:
- Builder
-
subRates
set values to the subRates- Parameters:
subRates
- value to be set- Returns:
- Builder
-
subRates
set value to the subRates- Parameters:
subRates
- value to be set- Returns:
- Builder
-
plusSubRates
add values to the subRates- Parameters:
subRates
- value to be set- Returns:
- Builder
-
plusSubRates
add the value to the subRates using the builder function- Parameters:
builder
- function to build the subRates value- Returns:
- Builder
-
withSubRates
set the value to the subRates using the builder function- Parameters:
builder
- function to build the subRates value- Returns:
- Builder
-
addSubRates
add the value to the subRates using the builder function- Parameters:
builder
- function to build the subRates value- Returns:
- Builder
-
setSubRates
set the value to the subRates using the builder function- Parameters:
builder
- function to build the subRates value- Returns:
- Builder
-
getId
The ID is always set if the tax rate is part of a TaxCategory. The external tax rates in a Cart do not contain an
id
.- Returns:
- id
-
getName
value of name}- Returns:
- name
-
getAmount
Percentage in the range of [0..1]. The sum of the amounts of all
subRates
, if there are any.- Returns:
- amount
-
getIncludedInPrice
value of includedInPrice}- Returns:
- includedInPrice
-
getCountry
Two-digit country code as per ISO 3166-1 alpha-2.
- Returns:
- country
-
getState
The state in the country
- Returns:
- state
-
getSubRates
value of subRates}- Returns:
- subRates
-
build
builds TaxRate with checking for non-null required values -
buildUnchecked
builds TaxRate without checking for non-null required values- Returns:
- TaxRate
-
of
factory method for an instance of TaxRateBuilder- Returns:
- builder
-
of
create builder for TaxRate instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-