001 002package com.commercetools.history.models.common; 003 004import java.util.*; 005 006import io.vrap.rmf.base.client.Builder; 007import io.vrap.rmf.base.client.utils.Generated; 008 009/** 010 * ReturnItemBuilder 011 * <hr> 012 * Example to create an instance using the builder pattern 013 * <div class=code-example> 014 * <pre><code class='java'> 015 * ReturnItem returnItem = ReturnItem.builder() 016 * .id("{id}") 017 * .quantity(1) 018 * .type("{type}") 019 * .comment("{comment}") 020 * .shipmentState(ReturnShipmentState.ADVISED) 021 * .paymentState(ReturnPaymentState.NON_REFUNDABLE) 022 * .lastModifiedAt("{lastModifiedAt}") 023 * .createdAt("{createdAt}") 024 * .build() 025 * </code></pre> 026 * </div> 027 */ 028@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 029public class ReturnItemBuilder implements Builder<ReturnItem> { 030 031 private String id; 032 033 private Integer quantity; 034 035 private String type; 036 037 private String comment; 038 039 private com.commercetools.history.models.common.ReturnShipmentState shipmentState; 040 041 private com.commercetools.history.models.common.ReturnPaymentState paymentState; 042 043 private String lastModifiedAt; 044 045 private String createdAt; 046 047 /** 048 * set the value to the id 049 * @param id value to be set 050 * @return Builder 051 */ 052 053 public ReturnItemBuilder id(final String id) { 054 this.id = id; 055 return this; 056 } 057 058 /** 059 * set the value to the quantity 060 * @param quantity value to be set 061 * @return Builder 062 */ 063 064 public ReturnItemBuilder quantity(final Integer quantity) { 065 this.quantity = quantity; 066 return this; 067 } 068 069 /** 070 * set the value to the type 071 * @param type value to be set 072 * @return Builder 073 */ 074 075 public ReturnItemBuilder type(final String type) { 076 this.type = type; 077 return this; 078 } 079 080 /** 081 * set the value to the comment 082 * @param comment value to be set 083 * @return Builder 084 */ 085 086 public ReturnItemBuilder comment(final String comment) { 087 this.comment = comment; 088 return this; 089 } 090 091 /** 092 * set the value to the shipmentState 093 * @param shipmentState value to be set 094 * @return Builder 095 */ 096 097 public ReturnItemBuilder shipmentState( 098 final com.commercetools.history.models.common.ReturnShipmentState shipmentState) { 099 this.shipmentState = shipmentState; 100 return this; 101 } 102 103 /** 104 * set the value to the paymentState 105 * @param paymentState value to be set 106 * @return Builder 107 */ 108 109 public ReturnItemBuilder paymentState( 110 final com.commercetools.history.models.common.ReturnPaymentState paymentState) { 111 this.paymentState = paymentState; 112 return this; 113 } 114 115 /** 116 * set the value to the lastModifiedAt 117 * @param lastModifiedAt value to be set 118 * @return Builder 119 */ 120 121 public ReturnItemBuilder lastModifiedAt(final String lastModifiedAt) { 122 this.lastModifiedAt = lastModifiedAt; 123 return this; 124 } 125 126 /** 127 * set the value to the createdAt 128 * @param createdAt value to be set 129 * @return Builder 130 */ 131 132 public ReturnItemBuilder createdAt(final String createdAt) { 133 this.createdAt = createdAt; 134 return this; 135 } 136 137 /** 138 * value of id} 139 * @return id 140 */ 141 142 public String getId() { 143 return this.id; 144 } 145 146 /** 147 * value of quantity} 148 * @return quantity 149 */ 150 151 public Integer getQuantity() { 152 return this.quantity; 153 } 154 155 /** 156 * value of type} 157 * @return type 158 */ 159 160 public String getType() { 161 return this.type; 162 } 163 164 /** 165 * value of comment} 166 * @return comment 167 */ 168 169 public String getComment() { 170 return this.comment; 171 } 172 173 /** 174 * value of shipmentState} 175 * @return shipmentState 176 */ 177 178 public com.commercetools.history.models.common.ReturnShipmentState getShipmentState() { 179 return this.shipmentState; 180 } 181 182 /** 183 * value of paymentState} 184 * @return paymentState 185 */ 186 187 public com.commercetools.history.models.common.ReturnPaymentState getPaymentState() { 188 return this.paymentState; 189 } 190 191 /** 192 * value of lastModifiedAt} 193 * @return lastModifiedAt 194 */ 195 196 public String getLastModifiedAt() { 197 return this.lastModifiedAt; 198 } 199 200 /** 201 * value of createdAt} 202 * @return createdAt 203 */ 204 205 public String getCreatedAt() { 206 return this.createdAt; 207 } 208 209 /** 210 * builds ReturnItem with checking for non-null required values 211 * @return ReturnItem 212 */ 213 public ReturnItem build() { 214 Objects.requireNonNull(id, ReturnItem.class + ": id is missing"); 215 Objects.requireNonNull(quantity, ReturnItem.class + ": quantity is missing"); 216 Objects.requireNonNull(type, ReturnItem.class + ": type is missing"); 217 Objects.requireNonNull(comment, ReturnItem.class + ": comment is missing"); 218 Objects.requireNonNull(shipmentState, ReturnItem.class + ": shipmentState is missing"); 219 Objects.requireNonNull(paymentState, ReturnItem.class + ": paymentState is missing"); 220 Objects.requireNonNull(lastModifiedAt, ReturnItem.class + ": lastModifiedAt is missing"); 221 Objects.requireNonNull(createdAt, ReturnItem.class + ": createdAt is missing"); 222 return new ReturnItemImpl(id, quantity, type, comment, shipmentState, paymentState, lastModifiedAt, createdAt); 223 } 224 225 /** 226 * builds ReturnItem without checking for non-null required values 227 * @return ReturnItem 228 */ 229 public ReturnItem buildUnchecked() { 230 return new ReturnItemImpl(id, quantity, type, comment, shipmentState, paymentState, lastModifiedAt, createdAt); 231 } 232 233 /** 234 * factory method for an instance of ReturnItemBuilder 235 * @return builder 236 */ 237 public static ReturnItemBuilder of() { 238 return new ReturnItemBuilder(); 239 } 240 241 /** 242 * create builder for ReturnItem instance 243 * @param template instance with prefilled values for the builder 244 * @return builder 245 */ 246 public static ReturnItemBuilder of(final ReturnItem template) { 247 ReturnItemBuilder builder = new ReturnItemBuilder(); 248 builder.id = template.getId(); 249 builder.quantity = template.getQuantity(); 250 builder.type = template.getType(); 251 builder.comment = template.getComment(); 252 builder.shipmentState = template.getShipmentState(); 253 builder.paymentState = template.getPaymentState(); 254 builder.lastModifiedAt = template.getLastModifiedAt(); 255 builder.createdAt = template.getCreatedAt(); 256 return builder; 257 } 258 259}