Interface TaxRate
public interface TaxRate
Shape of the value for addTaxRate and removeTaxRate actions
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()
-
Method Summary
Modifier and TypeMethodDescriptionstatic TaxRateBuilderbuilder()builder factory method for TaxRatestatic TaxRateBuildercreate builder for TaxRate instancecopyDeep()static TaxRatefactory method to create a deep copy of TaxRate@NotNull IntegerPercentage in the range of [0..1].@NotNull StringTwo-digit country code as per ISO 3166-1 alpha-2.@NotNull StringgetId()The ID is always set if the tax rate is part of a TaxCategory.@NotNull Boolean@NotNull StringgetName()@NotNull StringgetState()The state in the countrystatic TaxRateof()factory methodstatic TaxRatefactory method to create a shallow copy TaxRatevoidPercentage in the range of [0..1].voidsetCountry(String country) Two-digit country code as per ISO 3166-1 alpha-2.voidThe ID is always set if the tax rate is part of a TaxCategory.voidsetIncludedInPrice(Boolean includedInPrice) set includedInPricevoidset namevoidThe state in the countryvoidsetSubRates(SubRate... subRates) set subRatesvoidsetSubRates(List<SubRate> subRates) set subRatesstatic com.fasterxml.jackson.core.type.TypeReference<TaxRate>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithTaxRate(Function<TaxRate, T> helper) accessor map function
-
Method Details
-
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
- 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
- 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
- Returns:
- subRates
-
setId
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
-
setName
set name- Parameters:
name- value to be set
-
setAmount
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
-
setIncludedInPrice
set includedInPrice- Parameters:
includedInPrice- value to be set
-
setCountry
Two-digit country code as per ISO 3166-1 alpha-2.
- Parameters:
country- value to be set
-
setState
The state in the country
- Parameters:
state- value to be set
-
setSubRates
set subRates- Parameters:
subRates- values to be set
-
setSubRates
set subRates- Parameters:
subRates- values to be set
-
of
factory method- Returns:
- instance of TaxRate
-
of
factory method to create a shallow copy TaxRate- Parameters:
template- instance to be copied- Returns:
- copy instance
-
copyDeep
TaxRate copyDeep() -
deepCopy
factory method to create a deep copy of TaxRate- Parameters:
template- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for TaxRate- Returns:
- builder
-
builder
create builder for TaxRate instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-
withTaxRate
accessor map function- Type Parameters:
T- mapped type- Parameters:
helper- function to map the object- Returns:
- mapped value
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-