001 002package com.commercetools.importapi.models.common; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007 008import javax.annotation.Nullable; 009 010import com.fasterxml.jackson.annotation.*; 011import com.fasterxml.jackson.databind.annotation.*; 012 013import io.vrap.rmf.base.client.utils.Generated; 014 015/** 016 * <p>References a discount code by key.</p> 017 * 018 * <hr> 019 * Example to create an instance using the builder pattern 020 * <div class=code-example> 021 * <pre><code class='java'> 022 * DiscountCodeKeyReference discountCodeKeyReference = DiscountCodeKeyReference.builder() 023 * .key("{key}") 024 * .build() 025 * </code></pre> 026 * </div> 027 */ 028@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 029@JsonDeserialize(as = DiscountCodeKeyReferenceImpl.class) 030public interface DiscountCodeKeyReference extends KeyReference { 031 032 /** 033 * discriminator value for DiscountCodeKeyReference 034 */ 035 String DISCOUNT_CODE = "discount-code"; 036 037 /** 038 * factory method 039 * @return instance of DiscountCodeKeyReference 040 */ 041 public static DiscountCodeKeyReference of() { 042 return new DiscountCodeKeyReferenceImpl(); 043 } 044 045 /** 046 * factory method to create a shallow copy DiscountCodeKeyReference 047 * @param template instance to be copied 048 * @return copy instance 049 */ 050 public static DiscountCodeKeyReference of(final DiscountCodeKeyReference template) { 051 DiscountCodeKeyReferenceImpl instance = new DiscountCodeKeyReferenceImpl(); 052 instance.setKey(template.getKey()); 053 return instance; 054 } 055 056 /** 057 * factory method to create a deep copy of DiscountCodeKeyReference 058 * @param template instance to be copied 059 * @return copy instance 060 */ 061 @Nullable 062 public static DiscountCodeKeyReference deepCopy(@Nullable final DiscountCodeKeyReference template) { 063 if (template == null) { 064 return null; 065 } 066 DiscountCodeKeyReferenceImpl instance = new DiscountCodeKeyReferenceImpl(); 067 instance.setKey(template.getKey()); 068 return instance; 069 } 070 071 /** 072 * builder factory method for DiscountCodeKeyReference 073 * @return builder 074 */ 075 public static DiscountCodeKeyReferenceBuilder builder() { 076 return DiscountCodeKeyReferenceBuilder.of(); 077 } 078 079 /** 080 * create builder for DiscountCodeKeyReference instance 081 * @param template instance with prefilled values for the builder 082 * @return builder 083 */ 084 public static DiscountCodeKeyReferenceBuilder builder(final DiscountCodeKeyReference template) { 085 return DiscountCodeKeyReferenceBuilder.of(template); 086 } 087 088 /** 089 * accessor map function 090 * @param <T> mapped type 091 * @param helper function to map the object 092 * @return mapped value 093 */ 094 default <T> T withDiscountCodeKeyReference(Function<DiscountCodeKeyReference, T> helper) { 095 return helper.apply(this); 096 } 097 098 /** 099 * gives a TypeReference for usage with Jackson DataBind 100 * @return TypeReference 101 */ 102 public static com.fasterxml.jackson.core.type.TypeReference<DiscountCodeKeyReference> typeReference() { 103 return new com.fasterxml.jackson.core.type.TypeReference<DiscountCodeKeyReference>() { 104 @Override 105 public String toString() { 106 return "TypeReference<DiscountCodeKeyReference>"; 107 } 108 }; 109 } 110}