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