001 002package com.commercetools.api.models.order; 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 * OrderSetParcelCustomFieldActionBuilder 013 * <hr> 014 * Example to create an instance using the builder pattern 015 * <div class=code-example> 016 * <pre><code class='java'> 017 * OrderSetParcelCustomFieldAction orderSetParcelCustomFieldAction = OrderSetParcelCustomFieldAction.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 OrderSetParcelCustomFieldActionBuilder implements Builder<OrderSetParcelCustomFieldAction> { 025 026 @Nullable 027 private String parcelId; 028 029 @Nullable 030 private String parcelKey; 031 032 private String name; 033 034 @Nullable 035 private java.lang.Object value; 036 037 /** 038 * <p>Either <code>parcelId</code> or <code>parcelKey</code> is required for this update action.</p> 039 * @param parcelId value to be set 040 * @return Builder 041 */ 042 043 public OrderSetParcelCustomFieldActionBuilder parcelId(@Nullable final String parcelId) { 044 this.parcelId = parcelId; 045 return this; 046 } 047 048 /** 049 * <p>Either <code>parcelId</code> or <code>parcelKey</code> is required for this update action.</p> 050 * @param parcelKey value to be set 051 * @return Builder 052 */ 053 054 public OrderSetParcelCustomFieldActionBuilder parcelKey(@Nullable final String parcelKey) { 055 this.parcelKey = parcelKey; 056 return this; 057 } 058 059 /** 060 * <p>Name of the Custom Field.</p> 061 * @param name value to be set 062 * @return Builder 063 */ 064 065 public OrderSetParcelCustomFieldActionBuilder name(final String name) { 066 this.name = name; 067 return this; 068 } 069 070 /** 071 * <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> 072 * @param value value to be set 073 * @return Builder 074 */ 075 076 public OrderSetParcelCustomFieldActionBuilder value(@Nullable final java.lang.Object value) { 077 this.value = value; 078 return this; 079 } 080 081 /** 082 * <p>Either <code>parcelId</code> or <code>parcelKey</code> is required for this update action.</p> 083 * @return parcelId 084 */ 085 086 @Nullable 087 public String getParcelId() { 088 return this.parcelId; 089 } 090 091 /** 092 * <p>Either <code>parcelId</code> or <code>parcelKey</code> is required for this update action.</p> 093 * @return parcelKey 094 */ 095 096 @Nullable 097 public String getParcelKey() { 098 return this.parcelKey; 099 } 100 101 /** 102 * <p>Name of the Custom Field.</p> 103 * @return name 104 */ 105 106 public String getName() { 107 return this.name; 108 } 109 110 /** 111 * <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> 112 * @return value 113 */ 114 115 @Nullable 116 public java.lang.Object getValue() { 117 return this.value; 118 } 119 120 /** 121 * builds OrderSetParcelCustomFieldAction with checking for non-null required values 122 * @return OrderSetParcelCustomFieldAction 123 */ 124 public OrderSetParcelCustomFieldAction build() { 125 Objects.requireNonNull(name, OrderSetParcelCustomFieldAction.class + ": name is missing"); 126 return new OrderSetParcelCustomFieldActionImpl(parcelId, parcelKey, name, value); 127 } 128 129 /** 130 * builds OrderSetParcelCustomFieldAction without checking for non-null required values 131 * @return OrderSetParcelCustomFieldAction 132 */ 133 public OrderSetParcelCustomFieldAction buildUnchecked() { 134 return new OrderSetParcelCustomFieldActionImpl(parcelId, parcelKey, name, value); 135 } 136 137 /** 138 * factory method for an instance of OrderSetParcelCustomFieldActionBuilder 139 * @return builder 140 */ 141 public static OrderSetParcelCustomFieldActionBuilder of() { 142 return new OrderSetParcelCustomFieldActionBuilder(); 143 } 144 145 /** 146 * create builder for OrderSetParcelCustomFieldAction instance 147 * @param template instance with prefilled values for the builder 148 * @return builder 149 */ 150 public static OrderSetParcelCustomFieldActionBuilder of(final OrderSetParcelCustomFieldAction template) { 151 OrderSetParcelCustomFieldActionBuilder builder = new OrderSetParcelCustomFieldActionBuilder(); 152 builder.parcelId = template.getParcelId(); 153 builder.parcelKey = template.getParcelKey(); 154 builder.name = template.getName(); 155 builder.value = template.getValue(); 156 return builder; 157 } 158 159}