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