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

      public ReservationBuilder owner(Reference owner)

      A Reference represents a loose reference to another resource in the same Project identified by its id. The typeId indicates the type of the referenced resource. Each resource type has its corresponding Reference type, like ChannelReference. A referenced resource can be embedded through Reference Expansion. The expanded reference is the value of an additional obj field then.

      Parameters:
      owner - value to be set
      Returns:
      Builder
    • owner

      public ReservationBuilder owner(Function<ReferenceBuilder,Builder<? extends Reference>> builder)

      A Reference represents a loose reference to another resource in the same Project identified by its id. The typeId indicates the type of the referenced resource. Each resource type has its corresponding Reference type, like ChannelReference. A referenced resource can be embedded through Reference Expansion. The expanded reference is the value of an additional obj field then.

      Parameters:
      builder - function to build the owner value
      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()

      A Reference represents a loose reference to another resource in the same Project identified by its id. The typeId indicates the type of the referenced resource. Each resource type has its corresponding Reference type, like ChannelReference. A referenced resource can be embedded through Reference Expansion. The expanded reference is the value of an additional obj field then.

      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