001 002package com.commercetools.api.models.cart; 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 * CartSetShippingAddressActionBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * CartSetShippingAddressAction cartSetShippingAddressAction = CartSetShippingAddressAction.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 CartSetShippingAddressActionBuilder implements Builder<CartSetShippingAddressAction> { 025 026 @Nullable 027 private com.commercetools.api.models.common.BaseAddress address; 028 029 /** 030 * <p>Value to set. If not set, the shipping address is unset, and the <code>taxedPrice</code> and <code>taxRate</code> are unset in all Line Items of the Cart.</p> 031 * @param builder function to build the address value 032 * @return Builder 033 */ 034 035 public CartSetShippingAddressActionBuilder address( 036 Function<com.commercetools.api.models.common.BaseAddressBuilder, com.commercetools.api.models.common.BaseAddressBuilder> builder) { 037 this.address = builder.apply(com.commercetools.api.models.common.BaseAddressBuilder.of()).build(); 038 return this; 039 } 040 041 /** 042 * <p>Value to set. If not set, the shipping address is unset, and the <code>taxedPrice</code> and <code>taxRate</code> are unset in all Line Items of the Cart.</p> 043 * @param builder function to build the address value 044 * @return Builder 045 */ 046 047 public CartSetShippingAddressActionBuilder withAddress( 048 Function<com.commercetools.api.models.common.BaseAddressBuilder, com.commercetools.api.models.common.BaseAddress> builder) { 049 this.address = builder.apply(com.commercetools.api.models.common.BaseAddressBuilder.of()); 050 return this; 051 } 052 053 /** 054 * <p>Value to set. If not set, the shipping address is unset, and the <code>taxedPrice</code> and <code>taxRate</code> are unset in all Line Items of the Cart.</p> 055 * @param address value to be set 056 * @return Builder 057 */ 058 059 public CartSetShippingAddressActionBuilder address( 060 @Nullable final com.commercetools.api.models.common.BaseAddress address) { 061 this.address = address; 062 return this; 063 } 064 065 /** 066 * <p>Value to set. If not set, the shipping address is unset, and the <code>taxedPrice</code> and <code>taxRate</code> are unset in all Line Items of the Cart.</p> 067 * @return address 068 */ 069 070 @Nullable 071 public com.commercetools.api.models.common.BaseAddress getAddress() { 072 return this.address; 073 } 074 075 /** 076 * builds CartSetShippingAddressAction with checking for non-null required values 077 * @return CartSetShippingAddressAction 078 */ 079 public CartSetShippingAddressAction build() { 080 return new CartSetShippingAddressActionImpl(address); 081 } 082 083 /** 084 * builds CartSetShippingAddressAction without checking for non-null required values 085 * @return CartSetShippingAddressAction 086 */ 087 public CartSetShippingAddressAction buildUnchecked() { 088 return new CartSetShippingAddressActionImpl(address); 089 } 090 091 /** 092 * factory method for an instance of CartSetShippingAddressActionBuilder 093 * @return builder 094 */ 095 public static CartSetShippingAddressActionBuilder of() { 096 return new CartSetShippingAddressActionBuilder(); 097 } 098 099 /** 100 * create builder for CartSetShippingAddressAction instance 101 * @param template instance with prefilled values for the builder 102 * @return builder 103 */ 104 public static CartSetShippingAddressActionBuilder of(final CartSetShippingAddressAction template) { 105 CartSetShippingAddressActionBuilder builder = new CartSetShippingAddressActionBuilder(); 106 builder.address = template.getAddress(); 107 return builder; 108 } 109 110}