Class ReservationBuilder

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

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

     Reservation reservation = Reservation.builder()
             .quantity(1)
             .owner(ownerBuilder -> ownerBuilder)
             .createdAt("{createdAt}")
             .checkoutStartedAt("{checkoutStartedAt}")
             .build()
 
  • Constructor Details

    • ReservationBuilder

      public ReservationBuilder()
  • Method Details

    • quantity

      public ReservationBuilder quantity(Integer quantity)
      set the value to the quantity
      Parameters:
      quantity - value to be set
      Returns:
      Builder
    • owner

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

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

      public ReservationBuilder owner(Reference owner)
      set the value to the owner
      Parameters:
      owner - value to be set
      Returns:
      Builder
    • createdAt

      public ReservationBuilder createdAt(String createdAt)
      set the value to the createdAt
      Parameters:
      createdAt - value to be set
      Returns:
      Builder
    • checkoutStartedAt

      public ReservationBuilder checkoutStartedAt(String checkoutStartedAt)
      set the value to the checkoutStartedAt
      Parameters:
      checkoutStartedAt - value to be set
      Returns:
      Builder
    • getQuantity

      public Integer getQuantity()
      value of quantity}
      Returns:
      quantity
    • getOwner

      public Reference getOwner()
      value of owner}
      Returns:
      owner
    • getCreatedAt

      public String getCreatedAt()
      value of createdAt}
      Returns:
      createdAt
    • getCheckoutStartedAt

      public String getCheckoutStartedAt()
      value of checkoutStartedAt}
      Returns:
      checkoutStartedAt
    • build

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

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

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

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