001 002package com.commercetools.api.models.me; 003 004import java.util.*; 005 006import io.vrap.rmf.base.client.Builder; 007import io.vrap.rmf.base.client.utils.Generated; 008 009/** 010 * MyOrderFromCartDraftBuilder 011 * <hr> 012 * Example to create an instance using the builder pattern 013 * <div class=code-example> 014 * <pre><code class='java'> 015 * MyOrderFromCartDraft myOrderFromCartDraft = MyOrderFromCartDraft.builder() 016 * .id("{id}") 017 * .version(0.3) 018 * .build() 019 * </code></pre> 020 * </div> 021 */ 022@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 023public class MyOrderFromCartDraftBuilder implements Builder<MyOrderFromCartDraft> { 024 025 private String id; 026 027 private Long version; 028 029 /** 030 * <p>Unique identifier of the Cart that initiates an Order creation.</p> 031 * @param id value to be set 032 * @return Builder 033 */ 034 035 public MyOrderFromCartDraftBuilder id(final String id) { 036 this.id = id; 037 return this; 038 } 039 040 /** 041 * set the value to the version 042 * @param version value to be set 043 * @return Builder 044 */ 045 046 public MyOrderFromCartDraftBuilder version(final Long version) { 047 this.version = version; 048 return this; 049 } 050 051 /** 052 * <p>Unique identifier of the Cart that initiates an Order creation.</p> 053 * @return id 054 */ 055 056 public String getId() { 057 return this.id; 058 } 059 060 /** 061 * value of version} 062 * @return version 063 */ 064 065 public Long getVersion() { 066 return this.version; 067 } 068 069 /** 070 * builds MyOrderFromCartDraft with checking for non-null required values 071 * @return MyOrderFromCartDraft 072 */ 073 public MyOrderFromCartDraft build() { 074 Objects.requireNonNull(id, MyOrderFromCartDraft.class + ": id is missing"); 075 Objects.requireNonNull(version, MyOrderFromCartDraft.class + ": version is missing"); 076 return new MyOrderFromCartDraftImpl(id, version); 077 } 078 079 /** 080 * builds MyOrderFromCartDraft without checking for non-null required values 081 * @return MyOrderFromCartDraft 082 */ 083 public MyOrderFromCartDraft buildUnchecked() { 084 return new MyOrderFromCartDraftImpl(id, version); 085 } 086 087 /** 088 * factory method for an instance of MyOrderFromCartDraftBuilder 089 * @return builder 090 */ 091 public static MyOrderFromCartDraftBuilder of() { 092 return new MyOrderFromCartDraftBuilder(); 093 } 094 095 /** 096 * create builder for MyOrderFromCartDraft instance 097 * @param template instance with prefilled values for the builder 098 * @return builder 099 */ 100 public static MyOrderFromCartDraftBuilder of(final MyOrderFromCartDraft template) { 101 MyOrderFromCartDraftBuilder builder = new MyOrderFromCartDraftBuilder(); 102 builder.id = template.getId(); 103 builder.version = template.getVersion(); 104 return builder; 105 } 106 107}