001 002package com.commercetools.history.models.common; 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 * ProductSelectionSettingBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * ProductSelectionSetting productSelectionSetting = ProductSelectionSetting.builder() 017 * .productSelection(productSelectionBuilder -> productSelectionBuilder) 018 * .active(true) 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 ProductSelectionSettingBuilder implements Builder<ProductSelectionSetting> { 025 026 private com.commercetools.history.models.common.Reference productSelection; 027 028 private Boolean active; 029 030 /** 031 * set the value to the productSelection using the builder function 032 * @param builder function to build the productSelection value 033 * @return Builder 034 */ 035 036 public ProductSelectionSettingBuilder productSelection( 037 Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.ReferenceBuilder> builder) { 038 this.productSelection = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()).build(); 039 return this; 040 } 041 042 /** 043 * set the value to the productSelection using the builder function 044 * @param builder function to build the productSelection value 045 * @return Builder 046 */ 047 048 public ProductSelectionSettingBuilder withProductSelection( 049 Function<com.commercetools.history.models.common.ReferenceBuilder, com.commercetools.history.models.common.Reference> builder) { 050 this.productSelection = builder.apply(com.commercetools.history.models.common.ReferenceBuilder.of()); 051 return this; 052 } 053 054 /** 055 * set the value to the productSelection 056 * @param productSelection value to be set 057 * @return Builder 058 */ 059 060 public ProductSelectionSettingBuilder productSelection( 061 final com.commercetools.history.models.common.Reference productSelection) { 062 this.productSelection = productSelection; 063 return this; 064 } 065 066 /** 067 * set the value to the active 068 * @param active value to be set 069 * @return Builder 070 */ 071 072 public ProductSelectionSettingBuilder active(final Boolean active) { 073 this.active = active; 074 return this; 075 } 076 077 /** 078 * value of productSelection} 079 * @return productSelection 080 */ 081 082 public com.commercetools.history.models.common.Reference getProductSelection() { 083 return this.productSelection; 084 } 085 086 /** 087 * value of active} 088 * @return active 089 */ 090 091 public Boolean getActive() { 092 return this.active; 093 } 094 095 /** 096 * builds ProductSelectionSetting with checking for non-null required values 097 * @return ProductSelectionSetting 098 */ 099 public ProductSelectionSetting build() { 100 Objects.requireNonNull(productSelection, ProductSelectionSetting.class + ": productSelection is missing"); 101 Objects.requireNonNull(active, ProductSelectionSetting.class + ": active is missing"); 102 return new ProductSelectionSettingImpl(productSelection, active); 103 } 104 105 /** 106 * builds ProductSelectionSetting without checking for non-null required values 107 * @return ProductSelectionSetting 108 */ 109 public ProductSelectionSetting buildUnchecked() { 110 return new ProductSelectionSettingImpl(productSelection, active); 111 } 112 113 /** 114 * factory method for an instance of ProductSelectionSettingBuilder 115 * @return builder 116 */ 117 public static ProductSelectionSettingBuilder of() { 118 return new ProductSelectionSettingBuilder(); 119 } 120 121 /** 122 * create builder for ProductSelectionSetting instance 123 * @param template instance with prefilled values for the builder 124 * @return builder 125 */ 126 public static ProductSelectionSettingBuilder of(final ProductSelectionSetting template) { 127 ProductSelectionSettingBuilder builder = new ProductSelectionSettingBuilder(); 128 builder.productSelection = template.getProductSelection(); 129 builder.active = template.getActive(); 130 return builder; 131 } 132 133}