001 002package com.commercetools.history.models.common; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007 008import javax.annotation.Nullable; 009import javax.validation.Valid; 010import javax.validation.constraints.NotNull; 011 012import com.fasterxml.jackson.annotation.*; 013import com.fasterxml.jackson.databind.annotation.*; 014 015import io.vrap.rmf.base.client.utils.Generated; 016 017/** 018 * Reservation 019 * 020 * <hr> 021 * Example to create an instance using the builder pattern 022 * <div class=code-example> 023 * <pre><code class='java'> 024 * Reservation reservation = Reservation.builder() 025 * .quantity(1) 026 * .owner(ownerBuilder -> ownerBuilder) 027 * .createdAt("{createdAt}") 028 * .checkoutStartedAt("{checkoutStartedAt}") 029 * .build() 030 * </code></pre> 031 * </div> 032 */ 033@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 034@JsonDeserialize(as = ReservationImpl.class) 035public interface Reservation { 036 037 /** 038 * 039 * @return quantity 040 */ 041 @NotNull 042 @JsonProperty("quantity") 043 public Integer getQuantity(); 044 045 /** 046 * 047 * @return owner 048 */ 049 @NotNull 050 @Valid 051 @JsonProperty("owner") 052 public Reference getOwner(); 053 054 /** 055 * 056 * @return createdAt 057 */ 058 @NotNull 059 @JsonProperty("createdAt") 060 public String getCreatedAt(); 061 062 /** 063 * 064 * @return checkoutStartedAt 065 */ 066 @NotNull 067 @JsonProperty("checkoutStartedAt") 068 public String getCheckoutStartedAt(); 069 070 /** 071 * set quantity 072 * @param quantity value to be set 073 */ 074 075 public void setQuantity(final Integer quantity); 076 077 /** 078 * set owner 079 * @param owner value to be set 080 */ 081 082 public void setOwner(final Reference owner); 083 084 /** 085 * set createdAt 086 * @param createdAt value to be set 087 */ 088 089 public void setCreatedAt(final String createdAt); 090 091 /** 092 * set checkoutStartedAt 093 * @param checkoutStartedAt value to be set 094 */ 095 096 public void setCheckoutStartedAt(final String checkoutStartedAt); 097 098 /** 099 * factory method 100 * @return instance of Reservation 101 */ 102 public static Reservation of() { 103 return new ReservationImpl(); 104 } 105 106 /** 107 * factory method to create a shallow copy Reservation 108 * @param template instance to be copied 109 * @return copy instance 110 */ 111 public static Reservation of(final Reservation template) { 112 ReservationImpl instance = new ReservationImpl(); 113 instance.setQuantity(template.getQuantity()); 114 instance.setOwner(template.getOwner()); 115 instance.setCreatedAt(template.getCreatedAt()); 116 instance.setCheckoutStartedAt(template.getCheckoutStartedAt()); 117 return instance; 118 } 119 120 /** 121 * factory method to create a deep copy of Reservation 122 * @param template instance to be copied 123 * @return copy instance 124 */ 125 @Nullable 126 public static Reservation deepCopy(@Nullable final Reservation template) { 127 if (template == null) { 128 return null; 129 } 130 ReservationImpl instance = new ReservationImpl(); 131 instance.setQuantity(template.getQuantity()); 132 instance.setOwner(com.commercetools.history.models.common.Reference.deepCopy(template.getOwner())); 133 instance.setCreatedAt(template.getCreatedAt()); 134 instance.setCheckoutStartedAt(template.getCheckoutStartedAt()); 135 return instance; 136 } 137 138 /** 139 * builder factory method for Reservation 140 * @return builder 141 */ 142 public static ReservationBuilder builder() { 143 return ReservationBuilder.of(); 144 } 145 146 /** 147 * create builder for Reservation instance 148 * @param template instance with prefilled values for the builder 149 * @return builder 150 */ 151 public static ReservationBuilder builder(final Reservation template) { 152 return ReservationBuilder.of(template); 153 } 154 155 /** 156 * accessor map function 157 * @param <T> mapped type 158 * @param helper function to map the object 159 * @return mapped value 160 */ 161 default <T> T withReservation(Function<Reservation, T> helper) { 162 return helper.apply(this); 163 } 164 165 /** 166 * gives a TypeReference for usage with Jackson DataBind 167 * @return TypeReference 168 */ 169 public static com.fasterxml.jackson.core.type.TypeReference<Reservation> typeReference() { 170 return new com.fasterxml.jackson.core.type.TypeReference<Reservation>() { 171 @Override 172 public String toString() { 173 return "TypeReference<Reservation>"; 174 } 175 }; 176 } 177}