001 002package com.commercetools.api.models.cart; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007 008import javax.annotation.Nullable; 009import javax.validation.constraints.NotNull; 010 011import com.fasterxml.jackson.annotation.*; 012import com.fasterxml.jackson.databind.annotation.*; 013 014import io.vrap.rmf.base.client.utils.Generated; 015 016/** 017 * CartSetDeliveryAddressCustomFieldAction 018 * 019 * <hr> 020 * Example to create an instance using the builder pattern 021 * <div class=code-example> 022 * <pre><code class='java'> 023 * CartSetDeliveryAddressCustomFieldAction cartSetDeliveryAddressCustomFieldAction = CartSetDeliveryAddressCustomFieldAction.builder() 024 * .deliveryId("{deliveryId}") 025 * .name("{name}") 026 * .build() 027 * </code></pre> 028 * </div> 029 */ 030@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 031@JsonDeserialize(as = CartSetDeliveryAddressCustomFieldActionImpl.class) 032public interface CartSetDeliveryAddressCustomFieldAction extends CartUpdateAction { 033 034 /** 035 * discriminator value for CartSetDeliveryAddressCustomFieldAction 036 */ 037 String SET_DELIVERY_ADDRESS_CUSTOM_FIELD = "setDeliveryAddressCustomField"; 038 039 /** 040 * <p><code>id</code> of the Delivery.</p> 041 * @return deliveryId 042 */ 043 @NotNull 044 @JsonProperty("deliveryId") 045 public String getDeliveryId(); 046 047 /** 048 * <p>Name of the Custom Field.</p> 049 * @return name 050 */ 051 @NotNull 052 @JsonProperty("name") 053 public String getName(); 054 055 /** 056 * <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> 057 * @return value 058 */ 059 060 @JsonProperty("value") 061 public Object getValue(); 062 063 /** 064 * <p><code>id</code> of the Delivery.</p> 065 * @param deliveryId value to be set 066 */ 067 068 public void setDeliveryId(final String deliveryId); 069 070 /** 071 * <p>Name of the Custom Field.</p> 072 * @param name value to be set 073 */ 074 075 public void setName(final String name); 076 077 /** 078 * <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> 079 * @param value value to be set 080 */ 081 082 public void setValue(final Object value); 083 084 /** 085 * factory method 086 * @return instance of CartSetDeliveryAddressCustomFieldAction 087 */ 088 public static CartSetDeliveryAddressCustomFieldAction of() { 089 return new CartSetDeliveryAddressCustomFieldActionImpl(); 090 } 091 092 /** 093 * factory method to create a shallow copy CartSetDeliveryAddressCustomFieldAction 094 * @param template instance to be copied 095 * @return copy instance 096 */ 097 public static CartSetDeliveryAddressCustomFieldAction of(final CartSetDeliveryAddressCustomFieldAction template) { 098 CartSetDeliveryAddressCustomFieldActionImpl instance = new CartSetDeliveryAddressCustomFieldActionImpl(); 099 instance.setDeliveryId(template.getDeliveryId()); 100 instance.setName(template.getName()); 101 instance.setValue(template.getValue()); 102 return instance; 103 } 104 105 /** 106 * factory method to create a deep copy of CartSetDeliveryAddressCustomFieldAction 107 * @param template instance to be copied 108 * @return copy instance 109 */ 110 @Nullable 111 public static CartSetDeliveryAddressCustomFieldAction deepCopy( 112 @Nullable final CartSetDeliveryAddressCustomFieldAction template) { 113 if (template == null) { 114 return null; 115 } 116 CartSetDeliveryAddressCustomFieldActionImpl instance = new CartSetDeliveryAddressCustomFieldActionImpl(); 117 instance.setDeliveryId(template.getDeliveryId()); 118 instance.setName(template.getName()); 119 instance.setValue(template.getValue()); 120 return instance; 121 } 122 123 /** 124 * builder factory method for CartSetDeliveryAddressCustomFieldAction 125 * @return builder 126 */ 127 public static CartSetDeliveryAddressCustomFieldActionBuilder builder() { 128 return CartSetDeliveryAddressCustomFieldActionBuilder.of(); 129 } 130 131 /** 132 * create builder for CartSetDeliveryAddressCustomFieldAction instance 133 * @param template instance with prefilled values for the builder 134 * @return builder 135 */ 136 public static CartSetDeliveryAddressCustomFieldActionBuilder builder( 137 final CartSetDeliveryAddressCustomFieldAction template) { 138 return CartSetDeliveryAddressCustomFieldActionBuilder.of(template); 139 } 140 141 /** 142 * accessor map function 143 * @param <T> mapped type 144 * @param helper function to map the object 145 * @return mapped value 146 */ 147 default <T> T withCartSetDeliveryAddressCustomFieldAction( 148 Function<CartSetDeliveryAddressCustomFieldAction, T> helper) { 149 return helper.apply(this); 150 } 151 152 public static CartSetDeliveryAddressCustomFieldAction ofUnset(final String name, final String deliveryId) { 153 return CartSetDeliveryAddressCustomFieldActionBuilder.of().name(name).deliveryId(deliveryId).build(); 154 } 155 156 /** 157 * gives a TypeReference for usage with Jackson DataBind 158 * @return TypeReference 159 */ 160 public static com.fasterxml.jackson.core.type.TypeReference<CartSetDeliveryAddressCustomFieldAction> typeReference() { 161 return new com.fasterxml.jackson.core.type.TypeReference<CartSetDeliveryAddressCustomFieldAction>() { 162 @Override 163 public String toString() { 164 return "TypeReference<CartSetDeliveryAddressCustomFieldAction>"; 165 } 166 }; 167 } 168}