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 * CartDiscountChangeRequiresDiscountCodeAction 018 * 019 * <hr> 020 * Example to create an instance using the builder pattern 021 * <div class=code-example> 022 * <pre><code class='java'> 023 * CartDiscountChangeRequiresDiscountCodeAction cartDiscountChangeRequiresDiscountCodeAction = CartDiscountChangeRequiresDiscountCodeAction.builder() 024 * .requiresDiscountCode(true) 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 = CartDiscountChangeRequiresDiscountCodeActionImpl.class) 031public interface CartDiscountChangeRequiresDiscountCodeAction extends CartDiscountUpdateAction { 032 033 /** 034 * discriminator value for CartDiscountChangeRequiresDiscountCodeAction 035 */ 036 String CHANGE_REQUIRES_DISCOUNT_CODE = "changeRequiresDiscountCode"; 037 038 /** 039 * <p>New value to set. If set to <code>true</code>, the Discount can only be used in connection with a DiscountCode.</p> 040 * @return requiresDiscountCode 041 */ 042 @NotNull 043 @JsonProperty("requiresDiscountCode") 044 public Boolean getRequiresDiscountCode(); 045 046 /** 047 * <p>New value to set. If set to <code>true</code>, the Discount can only be used in connection with a DiscountCode.</p> 048 * @param requiresDiscountCode value to be set 049 */ 050 051 public void setRequiresDiscountCode(final Boolean requiresDiscountCode); 052 053 /** 054 * factory method 055 * @return instance of CartDiscountChangeRequiresDiscountCodeAction 056 */ 057 public static CartDiscountChangeRequiresDiscountCodeAction of() { 058 return new CartDiscountChangeRequiresDiscountCodeActionImpl(); 059 } 060 061 /** 062 * factory method to create a shallow copy CartDiscountChangeRequiresDiscountCodeAction 063 * @param template instance to be copied 064 * @return copy instance 065 */ 066 public static CartDiscountChangeRequiresDiscountCodeAction of( 067 final CartDiscountChangeRequiresDiscountCodeAction template) { 068 CartDiscountChangeRequiresDiscountCodeActionImpl instance = new CartDiscountChangeRequiresDiscountCodeActionImpl(); 069 instance.setRequiresDiscountCode(template.getRequiresDiscountCode()); 070 return instance; 071 } 072 073 /** 074 * factory method to create a deep copy of CartDiscountChangeRequiresDiscountCodeAction 075 * @param template instance to be copied 076 * @return copy instance 077 */ 078 @Nullable 079 public static CartDiscountChangeRequiresDiscountCodeAction deepCopy( 080 @Nullable final CartDiscountChangeRequiresDiscountCodeAction template) { 081 if (template == null) { 082 return null; 083 } 084 CartDiscountChangeRequiresDiscountCodeActionImpl instance = new CartDiscountChangeRequiresDiscountCodeActionImpl(); 085 instance.setRequiresDiscountCode(template.getRequiresDiscountCode()); 086 return instance; 087 } 088 089 /** 090 * builder factory method for CartDiscountChangeRequiresDiscountCodeAction 091 * @return builder 092 */ 093 public static CartDiscountChangeRequiresDiscountCodeActionBuilder builder() { 094 return CartDiscountChangeRequiresDiscountCodeActionBuilder.of(); 095 } 096 097 /** 098 * create builder for CartDiscountChangeRequiresDiscountCodeAction instance 099 * @param template instance with prefilled values for the builder 100 * @return builder 101 */ 102 public static CartDiscountChangeRequiresDiscountCodeActionBuilder builder( 103 final CartDiscountChangeRequiresDiscountCodeAction template) { 104 return CartDiscountChangeRequiresDiscountCodeActionBuilder.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 withCartDiscountChangeRequiresDiscountCodeAction( 114 Function<CartDiscountChangeRequiresDiscountCodeAction, T> helper) { 115 return helper.apply(this); 116 } 117 118 /** 119 * gives a TypeReference for usage with Jackson DataBind 120 * @return TypeReference 121 */ 122 public static com.fasterxml.jackson.core.type.TypeReference<CartDiscountChangeRequiresDiscountCodeAction> typeReference() { 123 return new com.fasterxml.jackson.core.type.TypeReference<CartDiscountChangeRequiresDiscountCodeAction>() { 124 @Override 125 public String toString() { 126 return "TypeReference<CartDiscountChangeRequiresDiscountCodeAction>"; 127 } 128 }; 129 } 130}