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 * CustomerSetStoresActionBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * CustomerSetStoresAction customerSetStoresAction = CustomerSetStoresAction.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 CustomerSetStoresActionBuilder implements Builder<CustomerSetStoresAction> { 025 026 @Nullable 027 private java.util.List<com.commercetools.api.models.store.StoreResourceIdentifier> stores; 028 029 /** 030 * <p>ResourceIdentifier of the Stores to set.</p> 031 * @param stores value to be set 032 * @return Builder 033 */ 034 035 public CustomerSetStoresActionBuilder stores( 036 @Nullable final com.commercetools.api.models.store.StoreResourceIdentifier... stores) { 037 this.stores = new ArrayList<>(Arrays.asList(stores)); 038 return this; 039 } 040 041 /** 042 * <p>ResourceIdentifier of the Stores to set.</p> 043 * @param stores value to be set 044 * @return Builder 045 */ 046 047 public CustomerSetStoresActionBuilder stores( 048 @Nullable final java.util.List<com.commercetools.api.models.store.StoreResourceIdentifier> stores) { 049 this.stores = stores; 050 return this; 051 } 052 053 /** 054 * <p>ResourceIdentifier of the Stores to set.</p> 055 * @param stores value to be set 056 * @return Builder 057 */ 058 059 public CustomerSetStoresActionBuilder plusStores( 060 @Nullable final com.commercetools.api.models.store.StoreResourceIdentifier... stores) { 061 if (this.stores == null) { 062 this.stores = new ArrayList<>(); 063 } 064 this.stores.addAll(Arrays.asList(stores)); 065 return this; 066 } 067 068 /** 069 * <p>ResourceIdentifier of the Stores to set.</p> 070 * @param builder function to build the stores value 071 * @return Builder 072 */ 073 074 public CustomerSetStoresActionBuilder plusStores( 075 Function<com.commercetools.api.models.store.StoreResourceIdentifierBuilder, com.commercetools.api.models.store.StoreResourceIdentifierBuilder> builder) { 076 if (this.stores == null) { 077 this.stores = new ArrayList<>(); 078 } 079 this.stores.add(builder.apply(com.commercetools.api.models.store.StoreResourceIdentifierBuilder.of()).build()); 080 return this; 081 } 082 083 /** 084 * <p>ResourceIdentifier of the Stores to set.</p> 085 * @param builder function to build the stores value 086 * @return Builder 087 */ 088 089 public CustomerSetStoresActionBuilder withStores( 090 Function<com.commercetools.api.models.store.StoreResourceIdentifierBuilder, com.commercetools.api.models.store.StoreResourceIdentifierBuilder> builder) { 091 this.stores = new ArrayList<>(); 092 this.stores.add(builder.apply(com.commercetools.api.models.store.StoreResourceIdentifierBuilder.of()).build()); 093 return this; 094 } 095 096 /** 097 * <p>ResourceIdentifier of the Stores to set.</p> 098 * @param builder function to build the stores value 099 * @return Builder 100 */ 101 102 public CustomerSetStoresActionBuilder addStores( 103 Function<com.commercetools.api.models.store.StoreResourceIdentifierBuilder, com.commercetools.api.models.store.StoreResourceIdentifier> builder) { 104 return plusStores(builder.apply(com.commercetools.api.models.store.StoreResourceIdentifierBuilder.of())); 105 } 106 107 /** 108 * <p>ResourceIdentifier of the Stores to set.</p> 109 * @param builder function to build the stores value 110 * @return Builder 111 */ 112 113 public CustomerSetStoresActionBuilder setStores( 114 Function<com.commercetools.api.models.store.StoreResourceIdentifierBuilder, com.commercetools.api.models.store.StoreResourceIdentifier> builder) { 115 return stores(builder.apply(com.commercetools.api.models.store.StoreResourceIdentifierBuilder.of())); 116 } 117 118 /** 119 * <p>ResourceIdentifier of the Stores to set.</p> 120 * @return stores 121 */ 122 123 @Nullable 124 public java.util.List<com.commercetools.api.models.store.StoreResourceIdentifier> getStores() { 125 return this.stores; 126 } 127 128 /** 129 * builds CustomerSetStoresAction with checking for non-null required values 130 * @return CustomerSetStoresAction 131 */ 132 public CustomerSetStoresAction build() { 133 return new CustomerSetStoresActionImpl(stores); 134 } 135 136 /** 137 * builds CustomerSetStoresAction without checking for non-null required values 138 * @return CustomerSetStoresAction 139 */ 140 public CustomerSetStoresAction buildUnchecked() { 141 return new CustomerSetStoresActionImpl(stores); 142 } 143 144 /** 145 * factory method for an instance of CustomerSetStoresActionBuilder 146 * @return builder 147 */ 148 public static CustomerSetStoresActionBuilder of() { 149 return new CustomerSetStoresActionBuilder(); 150 } 151 152 /** 153 * create builder for CustomerSetStoresAction instance 154 * @param template instance with prefilled values for the builder 155 * @return builder 156 */ 157 public static CustomerSetStoresActionBuilder of(final CustomerSetStoresAction template) { 158 CustomerSetStoresActionBuilder builder = new CustomerSetStoresActionBuilder(); 159 builder.stores = template.getStores(); 160 return builder; 161 } 162 163}