Class TaxRateBuilder

java.lang.Object
com.commercetools.importapi.models.prices.TaxRateBuilder
All Implemented Interfaces:
Builder<TaxRate>

public class TaxRateBuilder extends Object implements Builder<TaxRate>
TaxRateBuilder
Example to create an instance using the builder pattern

     TaxRate taxRate = TaxRate.builder()
             .name("{name}")
             .amount(0.3)
             .includedInPrice(true)
             .country("{country}")
             .build()
 
  • Constructor Details

    • TaxRateBuilder

      public TaxRateBuilder()
  • Method Details

    • id

      set the value to the id
      Parameters:
      id - value to be set
      Returns:
      Builder
    • name

      public TaxRateBuilder name(String name)
      set the value to the name
      Parameters:
      name - value to be set
      Returns:
      Builder
    • amount

      public TaxRateBuilder amount(Double amount)
      set the value to the amount
      Parameters:
      amount - value to be set
      Returns:
      Builder
    • includedInPrice

      public TaxRateBuilder includedInPrice(Boolean includedInPrice)
      set the value to the includedInPrice
      Parameters:
      includedInPrice - value to be set
      Returns:
      Builder
    • country

      public TaxRateBuilder country(String country)

      A two-digit country code as per ISO 3166-1 alpha-2.

      Parameters:
      country - value to be set
      Returns:
      Builder
    • state

      public TaxRateBuilder state(@Nullable String state)
      set the value to the state
      Parameters:
      state - value to be set
      Returns:
      Builder
    • subRates

      public TaxRateBuilder subRates(@Nullable SubRate... subRates)
      set values to the subRates
      Parameters:
      subRates - value to be set
      Returns:
      Builder
    • subRates

      public TaxRateBuilder subRates(@Nullable List<SubRate> subRates)
      set value to the subRates
      Parameters:
      subRates - value to be set
      Returns:
      Builder
    • plusSubRates

      public TaxRateBuilder plusSubRates(@Nullable SubRate... subRates)
      add values to the subRates
      Parameters:
      subRates - value to be set
      Returns:
      Builder
    • plusSubRates

      public TaxRateBuilder plusSubRates(Function<SubRateBuilder,SubRateBuilder> builder)
      add the value to the subRates using the builder function
      Parameters:
      builder - function to build the subRates value
      Returns:
      Builder
    • withSubRates

      public TaxRateBuilder withSubRates(Function<SubRateBuilder,SubRateBuilder> builder)
      set the value to the subRates using the builder function
      Parameters:
      builder - function to build the subRates value
      Returns:
      Builder
    • addSubRates

      public TaxRateBuilder addSubRates(Function<SubRateBuilder,SubRate> builder)
      add the value to the subRates using the builder function
      Parameters:
      builder - function to build the subRates value
      Returns:
      Builder
    • setSubRates

      public TaxRateBuilder setSubRates(Function<SubRateBuilder,SubRate> builder)
      set the value to the subRates using the builder function
      Parameters:
      builder - function to build the subRates value
      Returns:
      Builder
    • getId

      @Nullable public String getId()
      value of id}
      Returns:
      id
    • getName

      public String getName()
      value of name}
      Returns:
      name
    • getAmount

      public Double getAmount()
      value of amount}
      Returns:
      amount
    • getIncludedInPrice

      public Boolean getIncludedInPrice()
      value of includedInPrice}
      Returns:
      includedInPrice
    • getCountry

      public String getCountry()

      A two-digit country code as per ISO 3166-1 alpha-2.

      Returns:
      country
    • getState

      @Nullable public String getState()
      value of state}
      Returns:
      state
    • getSubRates

      @Nullable public List<SubRate> getSubRates()
      value of subRates}
      Returns:
      subRates
    • build

      public TaxRate build()
      builds TaxRate with checking for non-null required values
      Specified by:
      build in interface Builder<TaxRate>
      Returns:
      TaxRate
    • buildUnchecked

      public TaxRate buildUnchecked()
      builds TaxRate without checking for non-null required values
      Returns:
      TaxRate
    • of

      public static TaxRateBuilder of()
      factory method for an instance of TaxRateBuilder
      Returns:
      builder
    • of

      public static TaxRateBuilder of(TaxRate template)
      create builder for TaxRate instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder