001 002package com.commercetools.api.models.error; 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>Returned when a Product Discount could not be found that could be applied to the Price of a Product Variant.</p> 018 * <p>The error is returned as a failed response to the Get Matching ProductDiscount request.</p> 019 * 020 * <hr> 021 * Example to create an instance using the builder pattern 022 * <div class=code-example> 023 * <pre><code class='java'> 024 * GraphQLNoMatchingProductDiscountFoundError graphQLNoMatchingProductDiscountFoundError = GraphQLNoMatchingProductDiscountFoundError.builder() 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 = GraphQLNoMatchingProductDiscountFoundErrorImpl.class) 031public interface GraphQLNoMatchingProductDiscountFoundError extends GraphQLErrorObject { 032 033 /** 034 * discriminator value for GraphQLNoMatchingProductDiscountFoundError 035 */ 036 String NO_MATCHING_PRODUCT_DISCOUNT_FOUND = "NoMatchingProductDiscountFound"; 037 038 /** 039 * 040 * @return code 041 */ 042 @NotNull 043 @JsonProperty("code") 044 public String getCode(); 045 046 /** 047 * factory method 048 * @return instance of GraphQLNoMatchingProductDiscountFoundError 049 */ 050 public static GraphQLNoMatchingProductDiscountFoundError of() { 051 return new GraphQLNoMatchingProductDiscountFoundErrorImpl(); 052 } 053 054 /** 055 * factory method to create a shallow copy GraphQLNoMatchingProductDiscountFoundError 056 * @param template instance to be copied 057 * @return copy instance 058 */ 059 public static GraphQLNoMatchingProductDiscountFoundError of( 060 final GraphQLNoMatchingProductDiscountFoundError template) { 061 GraphQLNoMatchingProductDiscountFoundErrorImpl instance = new GraphQLNoMatchingProductDiscountFoundErrorImpl(); 062 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 063 return instance; 064 } 065 066 /** 067 * factory method to create a deep copy of GraphQLNoMatchingProductDiscountFoundError 068 * @param template instance to be copied 069 * @return copy instance 070 */ 071 @Nullable 072 public static GraphQLNoMatchingProductDiscountFoundError deepCopy( 073 @Nullable final GraphQLNoMatchingProductDiscountFoundError template) { 074 if (template == null) { 075 return null; 076 } 077 GraphQLNoMatchingProductDiscountFoundErrorImpl instance = new GraphQLNoMatchingProductDiscountFoundErrorImpl(); 078 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 079 return instance; 080 } 081 082 /** 083 * builder factory method for GraphQLNoMatchingProductDiscountFoundError 084 * @return builder 085 */ 086 public static GraphQLNoMatchingProductDiscountFoundErrorBuilder builder() { 087 return GraphQLNoMatchingProductDiscountFoundErrorBuilder.of(); 088 } 089 090 /** 091 * create builder for GraphQLNoMatchingProductDiscountFoundError instance 092 * @param template instance with prefilled values for the builder 093 * @return builder 094 */ 095 public static GraphQLNoMatchingProductDiscountFoundErrorBuilder builder( 096 final GraphQLNoMatchingProductDiscountFoundError template) { 097 return GraphQLNoMatchingProductDiscountFoundErrorBuilder.of(template); 098 } 099 100 /** 101 * accessor map function 102 * @param <T> mapped type 103 * @param helper function to map the object 104 * @return mapped value 105 */ 106 default <T> T withGraphQLNoMatchingProductDiscountFoundError( 107 Function<GraphQLNoMatchingProductDiscountFoundError, T> helper) { 108 return helper.apply(this); 109 } 110 111 /** 112 * gives a TypeReference for usage with Jackson DataBind 113 * @return TypeReference 114 */ 115 public static com.fasterxml.jackson.core.type.TypeReference<GraphQLNoMatchingProductDiscountFoundError> typeReference() { 116 return new com.fasterxml.jackson.core.type.TypeReference<GraphQLNoMatchingProductDiscountFoundError>() { 117 @Override 118 public String toString() { 119 return "TypeReference<GraphQLNoMatchingProductDiscountFoundError>"; 120 } 121 }; 122 } 123}