001 002package com.commercetools.api.models.cart_discount; 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 * CartDiscountSetCustomFieldActionBuilder 013 * <hr> 014 * Example to create an instance using the builder pattern 015 * <div class=code-example> 016 * <pre><code class='java'> 017 * CartDiscountSetCustomFieldAction cartDiscountSetCustomFieldAction = CartDiscountSetCustomFieldAction.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 CartDiscountSetCustomFieldActionBuilder implements Builder<CartDiscountSetCustomFieldAction> { 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 CartDiscountSetCustomFieldActionBuilder 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 CartDiscountSetCustomFieldActionBuilder 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 CartDiscountSetCustomFieldAction with checking for non-null required values 074 * @return CartDiscountSetCustomFieldAction 075 */ 076 public CartDiscountSetCustomFieldAction build() { 077 Objects.requireNonNull(name, CartDiscountSetCustomFieldAction.class + ": name is missing"); 078 return new CartDiscountSetCustomFieldActionImpl(name, value); 079 } 080 081 /** 082 * builds CartDiscountSetCustomFieldAction without checking for non-null required values 083 * @return CartDiscountSetCustomFieldAction 084 */ 085 public CartDiscountSetCustomFieldAction buildUnchecked() { 086 return new CartDiscountSetCustomFieldActionImpl(name, value); 087 } 088 089 /** 090 * factory method for an instance of CartDiscountSetCustomFieldActionBuilder 091 * @return builder 092 */ 093 public static CartDiscountSetCustomFieldActionBuilder of() { 094 return new CartDiscountSetCustomFieldActionBuilder(); 095 } 096 097 /** 098 * create builder for CartDiscountSetCustomFieldAction instance 099 * @param template instance with prefilled values for the builder 100 * @return builder 101 */ 102 public static CartDiscountSetCustomFieldActionBuilder of(final CartDiscountSetCustomFieldAction template) { 103 CartDiscountSetCustomFieldActionBuilder builder = new CartDiscountSetCustomFieldActionBuilder(); 104 builder.name = template.getName(); 105 builder.value = template.getValue(); 106 return builder; 107 } 108 109}