001 002package com.commercetools.api.models.me; 003 004import java.util.*; 005import java.util.function.Function; 006 007import javax.annotation.Nullable; 008 009import io.vrap.rmf.base.client.Builder; 010import io.vrap.rmf.base.client.utils.Generated; 011 012/** 013 * MyCartSetLineItemSupplyChannelActionBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * MyCartSetLineItemSupplyChannelAction myCartSetLineItemSupplyChannelAction = MyCartSetLineItemSupplyChannelAction.builder() 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 MyCartSetLineItemSupplyChannelActionBuilder implements Builder<MyCartSetLineItemSupplyChannelAction> { 025 026 @Nullable 027 private String lineItemId; 028 029 @Nullable 030 private String lineItemKey; 031 032 @Nullable 033 private com.commercetools.api.models.channel.ChannelResourceIdentifier supplyChannel; 034 035 /** 036 * <p><code>id</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p> 037 * @param lineItemId value to be set 038 * @return Builder 039 */ 040 041 public MyCartSetLineItemSupplyChannelActionBuilder lineItemId(@Nullable final String lineItemId) { 042 this.lineItemId = lineItemId; 043 return this; 044 } 045 046 /** 047 * <p><code>key</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p> 048 * @param lineItemKey value to be set 049 * @return Builder 050 */ 051 052 public MyCartSetLineItemSupplyChannelActionBuilder lineItemKey(@Nullable final String lineItemKey) { 053 this.lineItemKey = lineItemKey; 054 return this; 055 } 056 057 /** 058 * <ul> 059 * <li>If present, a Reference to the Channel is set for the LineItem specified by <code>lineItemId</code>.</li> 060 * <li>If not present, the current Reference to a supply channel will be removed from the LineItem specified by <code>lineItemId</code>. The Channel must have the <code>InventorySupply</code> ChannelRoleEnum.</li> 061 * </ul> 062 * @param builder function to build the supplyChannel value 063 * @return Builder 064 */ 065 066 public MyCartSetLineItemSupplyChannelActionBuilder supplyChannel( 067 Function<com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder, com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder> builder) { 068 this.supplyChannel = builder.apply(com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder.of()) 069 .build(); 070 return this; 071 } 072 073 /** 074 * <ul> 075 * <li>If present, a Reference to the Channel is set for the LineItem specified by <code>lineItemId</code>.</li> 076 * <li>If not present, the current Reference to a supply channel will be removed from the LineItem specified by <code>lineItemId</code>. The Channel must have the <code>InventorySupply</code> ChannelRoleEnum.</li> 077 * </ul> 078 * @param builder function to build the supplyChannel value 079 * @return Builder 080 */ 081 082 public MyCartSetLineItemSupplyChannelActionBuilder withSupplyChannel( 083 Function<com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder, com.commercetools.api.models.channel.ChannelResourceIdentifier> builder) { 084 this.supplyChannel = builder.apply(com.commercetools.api.models.channel.ChannelResourceIdentifierBuilder.of()); 085 return this; 086 } 087 088 /** 089 * <ul> 090 * <li>If present, a Reference to the Channel is set for the LineItem specified by <code>lineItemId</code>.</li> 091 * <li>If not present, the current Reference to a supply channel will be removed from the LineItem specified by <code>lineItemId</code>. The Channel must have the <code>InventorySupply</code> ChannelRoleEnum.</li> 092 * </ul> 093 * @param supplyChannel value to be set 094 * @return Builder 095 */ 096 097 public MyCartSetLineItemSupplyChannelActionBuilder supplyChannel( 098 @Nullable final com.commercetools.api.models.channel.ChannelResourceIdentifier supplyChannel) { 099 this.supplyChannel = supplyChannel; 100 return this; 101 } 102 103 /** 104 * <p><code>id</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p> 105 * @return lineItemId 106 */ 107 108 @Nullable 109 public String getLineItemId() { 110 return this.lineItemId; 111 } 112 113 /** 114 * <p><code>key</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p> 115 * @return lineItemKey 116 */ 117 118 @Nullable 119 public String getLineItemKey() { 120 return this.lineItemKey; 121 } 122 123 /** 124 * <ul> 125 * <li>If present, a Reference to the Channel is set for the LineItem specified by <code>lineItemId</code>.</li> 126 * <li>If not present, the current Reference to a supply channel will be removed from the LineItem specified by <code>lineItemId</code>. The Channel must have the <code>InventorySupply</code> ChannelRoleEnum.</li> 127 * </ul> 128 * @return supplyChannel 129 */ 130 131 @Nullable 132 public com.commercetools.api.models.channel.ChannelResourceIdentifier getSupplyChannel() { 133 return this.supplyChannel; 134 } 135 136 /** 137 * builds MyCartSetLineItemSupplyChannelAction with checking for non-null required values 138 * @return MyCartSetLineItemSupplyChannelAction 139 */ 140 public MyCartSetLineItemSupplyChannelAction build() { 141 return new MyCartSetLineItemSupplyChannelActionImpl(lineItemId, lineItemKey, supplyChannel); 142 } 143 144 /** 145 * builds MyCartSetLineItemSupplyChannelAction without checking for non-null required values 146 * @return MyCartSetLineItemSupplyChannelAction 147 */ 148 public MyCartSetLineItemSupplyChannelAction buildUnchecked() { 149 return new MyCartSetLineItemSupplyChannelActionImpl(lineItemId, lineItemKey, supplyChannel); 150 } 151 152 /** 153 * factory method for an instance of MyCartSetLineItemSupplyChannelActionBuilder 154 * @return builder 155 */ 156 public static MyCartSetLineItemSupplyChannelActionBuilder of() { 157 return new MyCartSetLineItemSupplyChannelActionBuilder(); 158 } 159 160 /** 161 * create builder for MyCartSetLineItemSupplyChannelAction instance 162 * @param template instance with prefilled values for the builder 163 * @return builder 164 */ 165 public static MyCartSetLineItemSupplyChannelActionBuilder of(final MyCartSetLineItemSupplyChannelAction template) { 166 MyCartSetLineItemSupplyChannelActionBuilder builder = new MyCartSetLineItemSupplyChannelActionBuilder(); 167 builder.lineItemId = template.getLineItemId(); 168 builder.lineItemKey = template.getLineItemKey(); 169 builder.supplyChannel = template.getSupplyChannel(); 170 return builder; 171 } 172 173}