001 002package com.commercetools.api.models.store; 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 * StoreRemoveProductSelectionActionBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * StoreRemoveProductSelectionAction storeRemoveProductSelectionAction = StoreRemoveProductSelectionAction.builder() 017 * .productSelection(productSelectionBuilder -> productSelectionBuilder) 018 * .build() 019 * </code></pre> 020 * </div> 021 */ 022@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 023public class StoreRemoveProductSelectionActionBuilder implements Builder<StoreRemoveProductSelectionAction> { 024 025 private com.commercetools.api.models.product_selection.ProductSelectionResourceIdentifier productSelection; 026 027 /** 028 * <p>Value to remove. The removed Product Selection is made offline.</p> 029 * @param builder function to build the productSelection value 030 * @return Builder 031 */ 032 033 public StoreRemoveProductSelectionActionBuilder productSelection( 034 Function<com.commercetools.api.models.product_selection.ProductSelectionResourceIdentifierBuilder, com.commercetools.api.models.product_selection.ProductSelectionResourceIdentifierBuilder> builder) { 035 this.productSelection = builder 036 .apply(com.commercetools.api.models.product_selection.ProductSelectionResourceIdentifierBuilder.of()) 037 .build(); 038 return this; 039 } 040 041 /** 042 * <p>Value to remove. The removed Product Selection is made offline.</p> 043 * @param builder function to build the productSelection value 044 * @return Builder 045 */ 046 047 public StoreRemoveProductSelectionActionBuilder withProductSelection( 048 Function<com.commercetools.api.models.product_selection.ProductSelectionResourceIdentifierBuilder, com.commercetools.api.models.product_selection.ProductSelectionResourceIdentifier> builder) { 049 this.productSelection = builder 050 .apply(com.commercetools.api.models.product_selection.ProductSelectionResourceIdentifierBuilder.of()); 051 return this; 052 } 053 054 /** 055 * <p>Value to remove. The removed Product Selection is made offline.</p> 056 * @param productSelection value to be set 057 * @return Builder 058 */ 059 060 public StoreRemoveProductSelectionActionBuilder productSelection( 061 final com.commercetools.api.models.product_selection.ProductSelectionResourceIdentifier productSelection) { 062 this.productSelection = productSelection; 063 return this; 064 } 065 066 /** 067 * <p>Value to remove. The removed Product Selection is made offline.</p> 068 * @return productSelection 069 */ 070 071 public com.commercetools.api.models.product_selection.ProductSelectionResourceIdentifier getProductSelection() { 072 return this.productSelection; 073 } 074 075 /** 076 * builds StoreRemoveProductSelectionAction with checking for non-null required values 077 * @return StoreRemoveProductSelectionAction 078 */ 079 public StoreRemoveProductSelectionAction build() { 080 Objects.requireNonNull(productSelection, 081 StoreRemoveProductSelectionAction.class + ": productSelection is missing"); 082 return new StoreRemoveProductSelectionActionImpl(productSelection); 083 } 084 085 /** 086 * builds StoreRemoveProductSelectionAction without checking for non-null required values 087 * @return StoreRemoveProductSelectionAction 088 */ 089 public StoreRemoveProductSelectionAction buildUnchecked() { 090 return new StoreRemoveProductSelectionActionImpl(productSelection); 091 } 092 093 /** 094 * factory method for an instance of StoreRemoveProductSelectionActionBuilder 095 * @return builder 096 */ 097 public static StoreRemoveProductSelectionActionBuilder of() { 098 return new StoreRemoveProductSelectionActionBuilder(); 099 } 100 101 /** 102 * create builder for StoreRemoveProductSelectionAction instance 103 * @param template instance with prefilled values for the builder 104 * @return builder 105 */ 106 public static StoreRemoveProductSelectionActionBuilder of(final StoreRemoveProductSelectionAction template) { 107 StoreRemoveProductSelectionActionBuilder builder = new StoreRemoveProductSelectionActionBuilder(); 108 builder.productSelection = template.getProductSelection(); 109 return builder; 110 } 111 112}