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.Valid;
010
011import com.commercetools.api.models.type.FieldContainer;
012import com.commercetools.api.models.type.TypeResourceIdentifier;
013import com.fasterxml.jackson.annotation.*;
014import com.fasterxml.jackson.databind.annotation.*;
015
016import io.vrap.rmf.base.client.utils.Generated;
017
018/**
019 * ShippingMethodSetCustomTypeAction
020 *
021 * <hr>
022 * Example to create an instance using the builder pattern
023 * <div class=code-example>
024 * <pre><code class='java'>
025 *     ShippingMethodSetCustomTypeAction shippingMethodSetCustomTypeAction = ShippingMethodSetCustomTypeAction.builder()
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 = ShippingMethodSetCustomTypeActionImpl.class)
032public interface ShippingMethodSetCustomTypeAction extends ShippingMethodUpdateAction {
033
034    /**
035     * discriminator value for ShippingMethodSetCustomTypeAction
036     */
037    String SET_CUSTOM_TYPE = "setCustomType";
038
039    /**
040     *  <p>Defines the Type that extends the ShippingMethod with Custom Fields. If absent, any existing Type and Custom Fields are removed from the ShippingMethod.</p>
041     * @return type
042     */
043    @Valid
044    @JsonProperty("type")
045    public TypeResourceIdentifier getType();
046
047    /**
048     *  <p>Sets the Custom Fields fields for the ShippingMethod.</p>
049     * @return fields
050     */
051    @Valid
052    @JsonProperty("fields")
053    public FieldContainer getFields();
054
055    /**
056     *  <p>Defines the Type that extends the ShippingMethod with Custom Fields. If absent, any existing Type and Custom Fields are removed from the ShippingMethod.</p>
057     * @param type value to be set
058     */
059
060    public void setType(final TypeResourceIdentifier type);
061
062    /**
063     *  <p>Sets the Custom Fields fields for the ShippingMethod.</p>
064     * @param fields value to be set
065     */
066
067    public void setFields(final FieldContainer fields);
068
069    /**
070     * factory method
071     * @return instance of ShippingMethodSetCustomTypeAction
072     */
073    public static ShippingMethodSetCustomTypeAction of() {
074        return new ShippingMethodSetCustomTypeActionImpl();
075    }
076
077    /**
078     * factory method to create a shallow copy ShippingMethodSetCustomTypeAction
079     * @param template instance to be copied
080     * @return copy instance
081     */
082    public static ShippingMethodSetCustomTypeAction of(final ShippingMethodSetCustomTypeAction template) {
083        ShippingMethodSetCustomTypeActionImpl instance = new ShippingMethodSetCustomTypeActionImpl();
084        instance.setType(template.getType());
085        instance.setFields(template.getFields());
086        return instance;
087    }
088
089    /**
090     * factory method to create a deep copy of ShippingMethodSetCustomTypeAction
091     * @param template instance to be copied
092     * @return copy instance
093     */
094    @Nullable
095    public static ShippingMethodSetCustomTypeAction deepCopy(
096            @Nullable final ShippingMethodSetCustomTypeAction template) {
097        if (template == null) {
098            return null;
099        }
100        ShippingMethodSetCustomTypeActionImpl instance = new ShippingMethodSetCustomTypeActionImpl();
101        instance.setType(com.commercetools.api.models.type.TypeResourceIdentifier.deepCopy(template.getType()));
102        instance.setFields(com.commercetools.api.models.type.FieldContainer.deepCopy(template.getFields()));
103        return instance;
104    }
105
106    /**
107     * builder factory method for ShippingMethodSetCustomTypeAction
108     * @return builder
109     */
110    public static ShippingMethodSetCustomTypeActionBuilder builder() {
111        return ShippingMethodSetCustomTypeActionBuilder.of();
112    }
113
114    /**
115     * create builder for ShippingMethodSetCustomTypeAction instance
116     * @param template instance with prefilled values for the builder
117     * @return builder
118     */
119    public static ShippingMethodSetCustomTypeActionBuilder builder(final ShippingMethodSetCustomTypeAction template) {
120        return ShippingMethodSetCustomTypeActionBuilder.of(template);
121    }
122
123    /**
124     * accessor map function
125     * @param <T> mapped type
126     * @param helper function to map the object
127     * @return mapped value
128     */
129    default <T> T withShippingMethodSetCustomTypeAction(Function<ShippingMethodSetCustomTypeAction, T> helper) {
130        return helper.apply(this);
131    }
132
133    /**
134     * gives a TypeReference for usage with Jackson DataBind
135     * @return TypeReference
136     */
137    public static com.fasterxml.jackson.core.type.TypeReference<ShippingMethodSetCustomTypeAction> typeReference() {
138        return new com.fasterxml.jackson.core.type.TypeReference<ShippingMethodSetCustomTypeAction>() {
139            @Override
140            public String toString() {
141                return "TypeReference<ShippingMethodSetCustomTypeAction>";
142            }
143        };
144    }
145}