001
002package com.commercetools.api.models.cart_discount;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009import javax.validation.Valid;
010import javax.validation.constraints.NotNull;
011
012import com.fasterxml.jackson.annotation.*;
013import com.fasterxml.jackson.databind.annotation.*;
014
015import io.vrap.rmf.base.client.utils.Generated;
016
017/**
018 * CartDiscountChangeTargetAction
019 *
020 * <hr>
021 * Example to create an instance using the builder pattern
022 * <div class=code-example>
023 * <pre><code class='java'>
024 *     CartDiscountChangeTargetAction cartDiscountChangeTargetAction = CartDiscountChangeTargetAction.builder()
025 *             .target(targetBuilder -> targetBuilder)
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 = CartDiscountChangeTargetActionImpl.class)
032public interface CartDiscountChangeTargetAction extends CartDiscountUpdateAction {
033
034    /**
035     * discriminator value for CartDiscountChangeTargetAction
036     */
037    String CHANGE_TARGET = "changeTarget";
038
039    /**
040     *  <p>New value to set.</p>
041     * @return target
042     */
043    @NotNull
044    @Valid
045    @JsonProperty("target")
046    public CartDiscountTarget getTarget();
047
048    /**
049     *  <p>New value to set.</p>
050     * @param target value to be set
051     */
052
053    public void setTarget(final CartDiscountTarget target);
054
055    /**
056     * factory method
057     * @return instance of CartDiscountChangeTargetAction
058     */
059    public static CartDiscountChangeTargetAction of() {
060        return new CartDiscountChangeTargetActionImpl();
061    }
062
063    /**
064     * factory method to create a shallow copy CartDiscountChangeTargetAction
065     * @param template instance to be copied
066     * @return copy instance
067     */
068    public static CartDiscountChangeTargetAction of(final CartDiscountChangeTargetAction template) {
069        CartDiscountChangeTargetActionImpl instance = new CartDiscountChangeTargetActionImpl();
070        instance.setTarget(template.getTarget());
071        return instance;
072    }
073
074    /**
075     * factory method to create a deep copy of CartDiscountChangeTargetAction
076     * @param template instance to be copied
077     * @return copy instance
078     */
079    @Nullable
080    public static CartDiscountChangeTargetAction deepCopy(@Nullable final CartDiscountChangeTargetAction template) {
081        if (template == null) {
082            return null;
083        }
084        CartDiscountChangeTargetActionImpl instance = new CartDiscountChangeTargetActionImpl();
085        instance.setTarget(
086            com.commercetools.api.models.cart_discount.CartDiscountTarget.deepCopy(template.getTarget()));
087        return instance;
088    }
089
090    /**
091     * builder factory method for CartDiscountChangeTargetAction
092     * @return builder
093     */
094    public static CartDiscountChangeTargetActionBuilder builder() {
095        return CartDiscountChangeTargetActionBuilder.of();
096    }
097
098    /**
099     * create builder for CartDiscountChangeTargetAction instance
100     * @param template instance with prefilled values for the builder
101     * @return builder
102     */
103    public static CartDiscountChangeTargetActionBuilder builder(final CartDiscountChangeTargetAction template) {
104        return CartDiscountChangeTargetActionBuilder.of(template);
105    }
106
107    /**
108     * accessor map function
109     * @param <T> mapped type
110     * @param helper function to map the object
111     * @return mapped value
112     */
113    default <T> T withCartDiscountChangeTargetAction(Function<CartDiscountChangeTargetAction, T> helper) {
114        return helper.apply(this);
115    }
116
117    /**
118     * gives a TypeReference for usage with Jackson DataBind
119     * @return TypeReference
120     */
121    public static com.fasterxml.jackson.core.type.TypeReference<CartDiscountChangeTargetAction> typeReference() {
122        return new com.fasterxml.jackson.core.type.TypeReference<CartDiscountChangeTargetAction>() {
123            @Override
124            public String toString() {
125                return "TypeReference<CartDiscountChangeTargetAction>";
126            }
127        };
128    }
129}