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.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>Discount is applied to CustomLineItems matching the <code>predicate</code>.</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 *     CartDiscountCustomLineItemsTarget cartDiscountCustomLineItemsTarget = CartDiscountCustomLineItemsTarget.builder()
024 *             .predicate("{predicate}")
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 = CartDiscountCustomLineItemsTargetImpl.class)
031public interface CartDiscountCustomLineItemsTarget extends CartDiscountTarget {
032
033    /**
034     * discriminator value for CartDiscountCustomLineItemsTarget
035     */
036    String CUSTOM_LINE_ITEMS = "customLineItems";
037
038    /**
039     *  <p>Valid CustomLineItem target predicate.</p>
040     * @return predicate
041     */
042    @NotNull
043    @JsonProperty("predicate")
044    public String getPredicate();
045
046    /**
047     *  <p>Valid CustomLineItem target predicate.</p>
048     * @param predicate value to be set
049     */
050
051    public void setPredicate(final String predicate);
052
053    /**
054     * factory method
055     * @return instance of CartDiscountCustomLineItemsTarget
056     */
057    public static CartDiscountCustomLineItemsTarget of() {
058        return new CartDiscountCustomLineItemsTargetImpl();
059    }
060
061    /**
062     * factory method to create a shallow copy CartDiscountCustomLineItemsTarget
063     * @param template instance to be copied
064     * @return copy instance
065     */
066    public static CartDiscountCustomLineItemsTarget of(final CartDiscountCustomLineItemsTarget template) {
067        CartDiscountCustomLineItemsTargetImpl instance = new CartDiscountCustomLineItemsTargetImpl();
068        instance.setPredicate(template.getPredicate());
069        return instance;
070    }
071
072    /**
073     * factory method to create a deep copy of CartDiscountCustomLineItemsTarget
074     * @param template instance to be copied
075     * @return copy instance
076     */
077    @Nullable
078    public static CartDiscountCustomLineItemsTarget deepCopy(
079            @Nullable final CartDiscountCustomLineItemsTarget template) {
080        if (template == null) {
081            return null;
082        }
083        CartDiscountCustomLineItemsTargetImpl instance = new CartDiscountCustomLineItemsTargetImpl();
084        instance.setPredicate(template.getPredicate());
085        return instance;
086    }
087
088    /**
089     * builder factory method for CartDiscountCustomLineItemsTarget
090     * @return builder
091     */
092    public static CartDiscountCustomLineItemsTargetBuilder builder() {
093        return CartDiscountCustomLineItemsTargetBuilder.of();
094    }
095
096    /**
097     * create builder for CartDiscountCustomLineItemsTarget instance
098     * @param template instance with prefilled values for the builder
099     * @return builder
100     */
101    public static CartDiscountCustomLineItemsTargetBuilder builder(final CartDiscountCustomLineItemsTarget template) {
102        return CartDiscountCustomLineItemsTargetBuilder.of(template);
103    }
104
105    /**
106     * accessor map function
107     * @param <T> mapped type
108     * @param helper function to map the object
109     * @return mapped value
110     */
111    default <T> T withCartDiscountCustomLineItemsTarget(Function<CartDiscountCustomLineItemsTarget, T> helper) {
112        return helper.apply(this);
113    }
114
115    /**
116     * gives a TypeReference for usage with Jackson DataBind
117     * @return TypeReference
118     */
119    public static com.fasterxml.jackson.core.type.TypeReference<CartDiscountCustomLineItemsTarget> typeReference() {
120        return new com.fasterxml.jackson.core.type.TypeReference<CartDiscountCustomLineItemsTarget>() {
121            @Override
122            public String toString() {
123                return "TypeReference<CartDiscountCustomLineItemsTarget>";
124            }
125        };
126    }
127}