Class TaxPortionDraftBuilder

java.lang.Object
com.commercetools.api.models.cart.TaxPortionDraftBuilder
All Implemented Interfaces:
Builder<TaxPortionDraft>

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

     TaxPortionDraft taxPortionDraft = TaxPortionDraft.builder()
             .rate(0.3)
             .amount(amountBuilder -> amountBuilder)
             .build()
 
  • Constructor Details

    • TaxPortionDraftBuilder

      public TaxPortionDraftBuilder()
  • Method Details

    • name

      Name of the tax portion.

      Parameters:
      name - value to be set
      Returns:
      Builder
    • rate

      public TaxPortionDraftBuilder rate(Double rate)

      A number in the range 0-1.

      Parameters:
      rate - value to be set
      Returns:
      Builder
    • amount

      Money value for the tax portion.

      Parameters:
      builder - function to build the amount value
      Returns:
      Builder
    • withAmount

      public TaxPortionDraftBuilder withAmount(Function<MoneyBuilder,Money> builder)

      Money value for the tax portion.

      Parameters:
      builder - function to build the amount value
      Returns:
      Builder
    • amount

      public TaxPortionDraftBuilder amount(Money amount)

      Money value for the tax portion.

      Parameters:
      amount - value to be set
      Returns:
      Builder
    • getName

      @Nullable public String getName()

      Name of the tax portion.

      Returns:
      name
    • getRate

      public Double getRate()

      A number in the range 0-1.

      Returns:
      rate
    • getAmount

      public Money getAmount()

      Money value for the tax portion.

      Returns:
      amount
    • build

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

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

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

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