001 002package com.commercetools.api.models.cart; 003 004import java.util.*; 005 006import javax.annotation.Nullable; 007 008import io.vrap.rmf.base.client.Builder; 009import io.vrap.rmf.base.client.utils.Generated; 010 011/** 012 * CartSetBillingAddressCustomFieldActionBuilder 013 * <hr> 014 * Example to create an instance using the builder pattern 015 * <div class=code-example> 016 * <pre><code class='java'> 017 * CartSetBillingAddressCustomFieldAction cartSetBillingAddressCustomFieldAction = CartSetBillingAddressCustomFieldAction.builder() 018 * .name("{name}") 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 CartSetBillingAddressCustomFieldActionBuilder implements Builder<CartSetBillingAddressCustomFieldAction> { 025 026 private String name; 027 028 @Nullable 029 private java.lang.Object value; 030 031 /** 032 * <p>Name of the Custom Field.</p> 033 * @param name value to be set 034 * @return Builder 035 */ 036 037 public CartSetBillingAddressCustomFieldActionBuilder name(final String name) { 038 this.name = name; 039 return this; 040 } 041 042 /** 043 * <p>If <code>value</code> is absent or <code>null</code>, this field will be removed if it exists. Removing a field that does not exist returns an InvalidOperation error. If <code>value</code> is provided, it is set for the field defined by <code>name</code>.</p> 044 * @param value value to be set 045 * @return Builder 046 */ 047 048 public CartSetBillingAddressCustomFieldActionBuilder value(@Nullable final java.lang.Object value) { 049 this.value = value; 050 return this; 051 } 052 053 /** 054 * <p>Name of the Custom Field.</p> 055 * @return name 056 */ 057 058 public String getName() { 059 return this.name; 060 } 061 062 /** 063 * <p>If <code>value</code> is absent or <code>null</code>, this field will be removed if it exists. Removing a field that does not exist returns an InvalidOperation error. If <code>value</code> is provided, it is set for the field defined by <code>name</code>.</p> 064 * @return value 065 */ 066 067 @Nullable 068 public java.lang.Object getValue() { 069 return this.value; 070 } 071 072 /** 073 * builds CartSetBillingAddressCustomFieldAction with checking for non-null required values 074 * @return CartSetBillingAddressCustomFieldAction 075 */ 076 public CartSetBillingAddressCustomFieldAction build() { 077 Objects.requireNonNull(name, CartSetBillingAddressCustomFieldAction.class + ": name is missing"); 078 return new CartSetBillingAddressCustomFieldActionImpl(name, value); 079 } 080 081 /** 082 * builds CartSetBillingAddressCustomFieldAction without checking for non-null required values 083 * @return CartSetBillingAddressCustomFieldAction 084 */ 085 public CartSetBillingAddressCustomFieldAction buildUnchecked() { 086 return new CartSetBillingAddressCustomFieldActionImpl(name, value); 087 } 088 089 /** 090 * factory method for an instance of CartSetBillingAddressCustomFieldActionBuilder 091 * @return builder 092 */ 093 public static CartSetBillingAddressCustomFieldActionBuilder of() { 094 return new CartSetBillingAddressCustomFieldActionBuilder(); 095 } 096 097 /** 098 * create builder for CartSetBillingAddressCustomFieldAction instance 099 * @param template instance with prefilled values for the builder 100 * @return builder 101 */ 102 public static CartSetBillingAddressCustomFieldActionBuilder of( 103 final CartSetBillingAddressCustomFieldAction template) { 104 CartSetBillingAddressCustomFieldActionBuilder builder = new CartSetBillingAddressCustomFieldActionBuilder(); 105 builder.name = template.getName(); 106 builder.value = template.getValue(); 107 return builder; 108 } 109 110}