Class PriceBuilder

java.lang.Object
com.commercetools.history.models.common.PriceBuilder
All Implemented Interfaces:
Builder<Price>

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

     Price price = Price.builder()
             .id("{id}")
             .value(valueBuilder -> valueBuilder)
             .build()
 
  • Constructor Details

    • PriceBuilder

      public PriceBuilder()
  • Method Details

    • id

      public PriceBuilder id(String id)
      set the value to the id
      Parameters:
      id - value to be set
      Returns:
      Builder
    • value

      set the value to the value using the builder function
      Parameters:
      builder - function to build the value value
      Returns:
      Builder
    • withValue

      public PriceBuilder withValue(Function<MoneyBuilder,Money> builder)
      set the value to the value using the builder function
      Parameters:
      builder - function to build the value value
      Returns:
      Builder
    • value

      public PriceBuilder value(Money value)
      set the value to the value
      Parameters:
      value - value to be set
      Returns:
      Builder
    • getId

      public String getId()
      value of id}
      Returns:
      id
    • getValue

      public Money getValue()
      value of value}
      Returns:
      value
    • build

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

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

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

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