001 002package com.commercetools.api.models.me; 003 004import java.util.*; 005import java.util.function.Function; 006 007import io.vrap.rmf.base.client.Builder; 008import io.vrap.rmf.base.client.utils.Generated; 009 010/** 011 * MyQuoteRequestUpdateBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * MyQuoteRequestUpdate myQuoteRequestUpdate = MyQuoteRequestUpdate.builder() 017 * .version(0.3) 018 * .plusActions(actionsBuilder -> actionsBuilder) 019 * .build() 020 * </code></pre> 021 * </div> 022 */ 023@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 024public class MyQuoteRequestUpdateBuilder implements Builder<MyQuoteRequestUpdate> { 025 026 private Long version; 027 028 private java.util.List<com.commercetools.api.models.me.MyQuoteRequestUpdateAction> actions; 029 030 /** 031 * set the value to the version 032 * @param version value to be set 033 * @return Builder 034 */ 035 036 public MyQuoteRequestUpdateBuilder version(final Long version) { 037 this.version = version; 038 return this; 039 } 040 041 /** 042 * set values to the actions 043 * @param actions value to be set 044 * @return Builder 045 */ 046 047 public MyQuoteRequestUpdateBuilder actions( 048 final com.commercetools.api.models.me.MyQuoteRequestUpdateAction... actions) { 049 this.actions = new ArrayList<>(Arrays.asList(actions)); 050 return this; 051 } 052 053 /** 054 * set value to the actions 055 * @param actions value to be set 056 * @return Builder 057 */ 058 059 public MyQuoteRequestUpdateBuilder actions( 060 final java.util.List<com.commercetools.api.models.me.MyQuoteRequestUpdateAction> actions) { 061 this.actions = actions; 062 return this; 063 } 064 065 /** 066 * add values to the actions 067 * @param actions value to be set 068 * @return Builder 069 */ 070 071 public MyQuoteRequestUpdateBuilder plusActions( 072 final com.commercetools.api.models.me.MyQuoteRequestUpdateAction... actions) { 073 if (this.actions == null) { 074 this.actions = new ArrayList<>(); 075 } 076 this.actions.addAll(Arrays.asList(actions)); 077 return this; 078 } 079 080 /** 081 * add a value to the actions using the builder function 082 * @param builder function to build the actions value 083 * @return Builder 084 */ 085 086 public MyQuoteRequestUpdateBuilder plusActions( 087 Function<com.commercetools.api.models.me.MyQuoteRequestUpdateActionBuilder, Builder<? extends com.commercetools.api.models.me.MyQuoteRequestUpdateAction>> builder) { 088 if (this.actions == null) { 089 this.actions = new ArrayList<>(); 090 } 091 this.actions.add(builder.apply(com.commercetools.api.models.me.MyQuoteRequestUpdateActionBuilder.of()).build()); 092 return this; 093 } 094 095 /** 096 * set the value to the actions using the builder function 097 * @param builder function to build the actions value 098 * @return Builder 099 */ 100 101 public MyQuoteRequestUpdateBuilder withActions( 102 Function<com.commercetools.api.models.me.MyQuoteRequestUpdateActionBuilder, Builder<? extends com.commercetools.api.models.me.MyQuoteRequestUpdateAction>> builder) { 103 this.actions = new ArrayList<>(); 104 this.actions.add(builder.apply(com.commercetools.api.models.me.MyQuoteRequestUpdateActionBuilder.of()).build()); 105 return this; 106 } 107 108 /** 109 * value of version} 110 * @return version 111 */ 112 113 public Long getVersion() { 114 return this.version; 115 } 116 117 /** 118 * value of actions} 119 * @return actions 120 */ 121 122 public java.util.List<com.commercetools.api.models.me.MyQuoteRequestUpdateAction> getActions() { 123 return this.actions; 124 } 125 126 /** 127 * builds MyQuoteRequestUpdate with checking for non-null required values 128 * @return MyQuoteRequestUpdate 129 */ 130 public MyQuoteRequestUpdate build() { 131 Objects.requireNonNull(version, MyQuoteRequestUpdate.class + ": version is missing"); 132 Objects.requireNonNull(actions, MyQuoteRequestUpdate.class + ": actions is missing"); 133 return new MyQuoteRequestUpdateImpl(version, actions); 134 } 135 136 /** 137 * builds MyQuoteRequestUpdate without checking for non-null required values 138 * @return MyQuoteRequestUpdate 139 */ 140 public MyQuoteRequestUpdate buildUnchecked() { 141 return new MyQuoteRequestUpdateImpl(version, actions); 142 } 143 144 /** 145 * factory method for an instance of MyQuoteRequestUpdateBuilder 146 * @return builder 147 */ 148 public static MyQuoteRequestUpdateBuilder of() { 149 return new MyQuoteRequestUpdateBuilder(); 150 } 151 152 /** 153 * create builder for MyQuoteRequestUpdate instance 154 * @param template instance with prefilled values for the builder 155 * @return builder 156 */ 157 public static MyQuoteRequestUpdateBuilder of(final MyQuoteRequestUpdate template) { 158 MyQuoteRequestUpdateBuilder builder = new MyQuoteRequestUpdateBuilder(); 159 builder.version = template.getVersion(); 160 builder.actions = template.getActions(); 161 return builder; 162 } 163 164}