001 002package com.commercetools.api.models.order; 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 * OrderRemovePaymentActionBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * OrderRemovePaymentAction orderRemovePaymentAction = OrderRemovePaymentAction.builder() 017 * .payment(paymentBuilder -> paymentBuilder) 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 OrderRemovePaymentActionBuilder implements Builder<OrderRemovePaymentAction> { 024 025 private com.commercetools.api.models.payment.PaymentResourceIdentifier payment; 026 027 /** 028 * <p>ResourceIdentifier of a Payment.</p> 029 * @param builder function to build the payment value 030 * @return Builder 031 */ 032 033 public OrderRemovePaymentActionBuilder payment( 034 Function<com.commercetools.api.models.payment.PaymentResourceIdentifierBuilder, com.commercetools.api.models.payment.PaymentResourceIdentifierBuilder> builder) { 035 this.payment = builder.apply(com.commercetools.api.models.payment.PaymentResourceIdentifierBuilder.of()) 036 .build(); 037 return this; 038 } 039 040 /** 041 * <p>ResourceIdentifier of a Payment.</p> 042 * @param builder function to build the payment value 043 * @return Builder 044 */ 045 046 public OrderRemovePaymentActionBuilder withPayment( 047 Function<com.commercetools.api.models.payment.PaymentResourceIdentifierBuilder, com.commercetools.api.models.payment.PaymentResourceIdentifier> builder) { 048 this.payment = builder.apply(com.commercetools.api.models.payment.PaymentResourceIdentifierBuilder.of()); 049 return this; 050 } 051 052 /** 053 * <p>ResourceIdentifier of a Payment.</p> 054 * @param payment value to be set 055 * @return Builder 056 */ 057 058 public OrderRemovePaymentActionBuilder payment( 059 final com.commercetools.api.models.payment.PaymentResourceIdentifier payment) { 060 this.payment = payment; 061 return this; 062 } 063 064 /** 065 * <p>ResourceIdentifier of a Payment.</p> 066 * @return payment 067 */ 068 069 public com.commercetools.api.models.payment.PaymentResourceIdentifier getPayment() { 070 return this.payment; 071 } 072 073 /** 074 * builds OrderRemovePaymentAction with checking for non-null required values 075 * @return OrderRemovePaymentAction 076 */ 077 public OrderRemovePaymentAction build() { 078 Objects.requireNonNull(payment, OrderRemovePaymentAction.class + ": payment is missing"); 079 return new OrderRemovePaymentActionImpl(payment); 080 } 081 082 /** 083 * builds OrderRemovePaymentAction without checking for non-null required values 084 * @return OrderRemovePaymentAction 085 */ 086 public OrderRemovePaymentAction buildUnchecked() { 087 return new OrderRemovePaymentActionImpl(payment); 088 } 089 090 /** 091 * factory method for an instance of OrderRemovePaymentActionBuilder 092 * @return builder 093 */ 094 public static OrderRemovePaymentActionBuilder of() { 095 return new OrderRemovePaymentActionBuilder(); 096 } 097 098 /** 099 * create builder for OrderRemovePaymentAction instance 100 * @param template instance with prefilled values for the builder 101 * @return builder 102 */ 103 public static OrderRemovePaymentActionBuilder of(final OrderRemovePaymentAction template) { 104 OrderRemovePaymentActionBuilder builder = new OrderRemovePaymentActionBuilder(); 105 builder.payment = template.getPayment(); 106 return builder; 107 } 108 109}