001 002package com.commercetools.api.models.order_edit; 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 * StagedOrderSetShippingAddressCustomTypeActionBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * StagedOrderSetShippingAddressCustomTypeAction stagedOrderSetShippingAddressCustomTypeAction = StagedOrderSetShippingAddressCustomTypeAction.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 StagedOrderSetShippingAddressCustomTypeActionBuilder 025 implements Builder<StagedOrderSetShippingAddressCustomTypeAction> { 026 027 @Nullable 028 private com.commercetools.api.models.type.TypeResourceIdentifier type; 029 030 @Nullable 031 private com.commercetools.api.models.type.FieldContainer fields; 032 033 /** 034 * <p>Defines the Type that extends the <code>shippingAddress</code> with Custom Fields. If absent, any existing Type and Custom Fields are removed from the <code>shippingAddress</code>.</p> 035 * @param builder function to build the type value 036 * @return Builder 037 */ 038 039 public StagedOrderSetShippingAddressCustomTypeActionBuilder type( 040 Function<com.commercetools.api.models.type.TypeResourceIdentifierBuilder, com.commercetools.api.models.type.TypeResourceIdentifierBuilder> builder) { 041 this.type = builder.apply(com.commercetools.api.models.type.TypeResourceIdentifierBuilder.of()).build(); 042 return this; 043 } 044 045 /** 046 * <p>Defines the Type that extends the <code>shippingAddress</code> with Custom Fields. If absent, any existing Type and Custom Fields are removed from the <code>shippingAddress</code>.</p> 047 * @param builder function to build the type value 048 * @return Builder 049 */ 050 051 public StagedOrderSetShippingAddressCustomTypeActionBuilder withType( 052 Function<com.commercetools.api.models.type.TypeResourceIdentifierBuilder, com.commercetools.api.models.type.TypeResourceIdentifier> builder) { 053 this.type = builder.apply(com.commercetools.api.models.type.TypeResourceIdentifierBuilder.of()); 054 return this; 055 } 056 057 /** 058 * <p>Defines the Type that extends the <code>shippingAddress</code> with Custom Fields. If absent, any existing Type and Custom Fields are removed from the <code>shippingAddress</code>.</p> 059 * @param type value to be set 060 * @return Builder 061 */ 062 063 public StagedOrderSetShippingAddressCustomTypeActionBuilder type( 064 @Nullable final com.commercetools.api.models.type.TypeResourceIdentifier type) { 065 this.type = type; 066 return this; 067 } 068 069 /** 070 * <p>Sets the Custom Fields fields for the <code>shippingAddress</code>.</p> 071 * @param builder function to build the fields value 072 * @return Builder 073 */ 074 075 public StagedOrderSetShippingAddressCustomTypeActionBuilder fields( 076 Function<com.commercetools.api.models.type.FieldContainerBuilder, com.commercetools.api.models.type.FieldContainerBuilder> builder) { 077 this.fields = builder.apply(com.commercetools.api.models.type.FieldContainerBuilder.of()).build(); 078 return this; 079 } 080 081 /** 082 * <p>Sets the Custom Fields fields for the <code>shippingAddress</code>.</p> 083 * @param builder function to build the fields value 084 * @return Builder 085 */ 086 087 public StagedOrderSetShippingAddressCustomTypeActionBuilder withFields( 088 Function<com.commercetools.api.models.type.FieldContainerBuilder, com.commercetools.api.models.type.FieldContainer> builder) { 089 this.fields = builder.apply(com.commercetools.api.models.type.FieldContainerBuilder.of()); 090 return this; 091 } 092 093 /** 094 * <p>Sets the Custom Fields fields for the <code>shippingAddress</code>.</p> 095 * @param fields value to be set 096 * @return Builder 097 */ 098 099 public StagedOrderSetShippingAddressCustomTypeActionBuilder fields( 100 @Nullable final com.commercetools.api.models.type.FieldContainer fields) { 101 this.fields = fields; 102 return this; 103 } 104 105 /** 106 * <p>Defines the Type that extends the <code>shippingAddress</code> with Custom Fields. If absent, any existing Type and Custom Fields are removed from the <code>shippingAddress</code>.</p> 107 * @return type 108 */ 109 110 @Nullable 111 public com.commercetools.api.models.type.TypeResourceIdentifier getType() { 112 return this.type; 113 } 114 115 /** 116 * <p>Sets the Custom Fields fields for the <code>shippingAddress</code>.</p> 117 * @return fields 118 */ 119 120 @Nullable 121 public com.commercetools.api.models.type.FieldContainer getFields() { 122 return this.fields; 123 } 124 125 /** 126 * builds StagedOrderSetShippingAddressCustomTypeAction with checking for non-null required values 127 * @return StagedOrderSetShippingAddressCustomTypeAction 128 */ 129 public StagedOrderSetShippingAddressCustomTypeAction build() { 130 return new StagedOrderSetShippingAddressCustomTypeActionImpl(type, fields); 131 } 132 133 /** 134 * builds StagedOrderSetShippingAddressCustomTypeAction without checking for non-null required values 135 * @return StagedOrderSetShippingAddressCustomTypeAction 136 */ 137 public StagedOrderSetShippingAddressCustomTypeAction buildUnchecked() { 138 return new StagedOrderSetShippingAddressCustomTypeActionImpl(type, fields); 139 } 140 141 /** 142 * factory method for an instance of StagedOrderSetShippingAddressCustomTypeActionBuilder 143 * @return builder 144 */ 145 public static StagedOrderSetShippingAddressCustomTypeActionBuilder of() { 146 return new StagedOrderSetShippingAddressCustomTypeActionBuilder(); 147 } 148 149 /** 150 * create builder for StagedOrderSetShippingAddressCustomTypeAction instance 151 * @param template instance with prefilled values for the builder 152 * @return builder 153 */ 154 public static StagedOrderSetShippingAddressCustomTypeActionBuilder of( 155 final StagedOrderSetShippingAddressCustomTypeAction template) { 156 StagedOrderSetShippingAddressCustomTypeActionBuilder builder = new StagedOrderSetShippingAddressCustomTypeActionBuilder(); 157 builder.type = template.getType(); 158 builder.fields = template.getFields(); 159 return builder; 160 } 161 162}