001
002package com.commercetools.api.models.shipping_method;
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 *  <p>This action sets, overwrites, or removes any existing Custom Field for an existing ShippingMethod.</p>
018 *
019 * <hr>
020 * Example to create an instance using the builder pattern
021 * <div class=code-example>
022 * <pre><code class='java'>
023 *     ShippingMethodSetCustomFieldAction shippingMethodSetCustomFieldAction = ShippingMethodSetCustomFieldAction.builder()
024 *             .name("{name}")
025 *             .build()
026 * </code></pre>
027 * </div>
028 */
029@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
030@JsonDeserialize(as = ShippingMethodSetCustomFieldActionImpl.class)
031public interface ShippingMethodSetCustomFieldAction extends ShippingMethodUpdateAction {
032
033    /**
034     * discriminator value for ShippingMethodSetCustomFieldAction
035     */
036    String SET_CUSTOM_FIELD = "setCustomField";
037
038    /**
039     *  <p>Name of the Custom Field.</p>
040     * @return name
041     */
042    @NotNull
043    @JsonProperty("name")
044    public String getName();
045
046    /**
047     *  <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>
048     * @return value
049     */
050
051    @JsonProperty("value")
052    public Object getValue();
053
054    /**
055     *  <p>Name of the Custom Field.</p>
056     * @param name value to be set
057     */
058
059    public void setName(final String name);
060
061    /**
062     *  <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>
063     * @param value value to be set
064     */
065
066    public void setValue(final Object value);
067
068    /**
069     * factory method
070     * @return instance of ShippingMethodSetCustomFieldAction
071     */
072    public static ShippingMethodSetCustomFieldAction of() {
073        return new ShippingMethodSetCustomFieldActionImpl();
074    }
075
076    /**
077     * factory method to create a shallow copy ShippingMethodSetCustomFieldAction
078     * @param template instance to be copied
079     * @return copy instance
080     */
081    public static ShippingMethodSetCustomFieldAction of(final ShippingMethodSetCustomFieldAction template) {
082        ShippingMethodSetCustomFieldActionImpl instance = new ShippingMethodSetCustomFieldActionImpl();
083        instance.setName(template.getName());
084        instance.setValue(template.getValue());
085        return instance;
086    }
087
088    /**
089     * factory method to create a deep copy of ShippingMethodSetCustomFieldAction
090     * @param template instance to be copied
091     * @return copy instance
092     */
093    @Nullable
094    public static ShippingMethodSetCustomFieldAction deepCopy(
095            @Nullable final ShippingMethodSetCustomFieldAction template) {
096        if (template == null) {
097            return null;
098        }
099        ShippingMethodSetCustomFieldActionImpl instance = new ShippingMethodSetCustomFieldActionImpl();
100        instance.setName(template.getName());
101        instance.setValue(template.getValue());
102        return instance;
103    }
104
105    /**
106     * builder factory method for ShippingMethodSetCustomFieldAction
107     * @return builder
108     */
109    public static ShippingMethodSetCustomFieldActionBuilder builder() {
110        return ShippingMethodSetCustomFieldActionBuilder.of();
111    }
112
113    /**
114     * create builder for ShippingMethodSetCustomFieldAction instance
115     * @param template instance with prefilled values for the builder
116     * @return builder
117     */
118    public static ShippingMethodSetCustomFieldActionBuilder builder(final ShippingMethodSetCustomFieldAction template) {
119        return ShippingMethodSetCustomFieldActionBuilder.of(template);
120    }
121
122    /**
123     * accessor map function
124     * @param <T> mapped type
125     * @param helper function to map the object
126     * @return mapped value
127     */
128    default <T> T withShippingMethodSetCustomFieldAction(Function<ShippingMethodSetCustomFieldAction, T> helper) {
129        return helper.apply(this);
130    }
131
132    public static ShippingMethodSetCustomFieldAction ofUnset(final String name) {
133        return ShippingMethodSetCustomFieldActionBuilder.of().name(name).build();
134    }
135
136    /**
137     * gives a TypeReference for usage with Jackson DataBind
138     * @return TypeReference
139     */
140    public static com.fasterxml.jackson.core.type.TypeReference<ShippingMethodSetCustomFieldAction> typeReference() {
141        return new com.fasterxml.jackson.core.type.TypeReference<ShippingMethodSetCustomFieldAction>() {
142            @Override
143            public String toString() {
144                return "TypeReference<ShippingMethodSetCustomFieldAction>";
145            }
146        };
147    }
148}