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 the query times out.</p> 018 * <p>If a query constantly times out, please check if it follows the performance best practices.</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 * QueryTimedOutError queryTimedOutError = QueryTimedOutError.builder() 025 * .message("{message}") 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 = QueryTimedOutErrorImpl.class) 032public interface QueryTimedOutError extends ErrorObject { 033 034 /** 035 * discriminator value for QueryTimedOutError 036 */ 037 String QUERY_TIMED_OUT = "QueryTimedOut"; 038 039 /** 040 * 041 * @return code 042 */ 043 @NotNull 044 @JsonProperty("code") 045 public String getCode(); 046 047 /** 048 * <p><code>"The query timed out. If your query constantly times out, please check that it follows the performance best practices (see https://docs.commercetools.com/api/predicates/query#performance-considerations)."</code></p> 049 * @return message 050 */ 051 @NotNull 052 @JsonProperty("message") 053 public String getMessage(); 054 055 /** 056 * <p><code>"The query timed out. If your query constantly times out, please check that it follows the performance best practices (see https://docs.commercetools.com/api/predicates/query#performance-considerations)."</code></p> 057 * @param message value to be set 058 */ 059 060 public void setMessage(final String message); 061 062 /** 063 * factory method 064 * @return instance of QueryTimedOutError 065 */ 066 public static QueryTimedOutError of() { 067 return new QueryTimedOutErrorImpl(); 068 } 069 070 /** 071 * factory method to create a shallow copy QueryTimedOutError 072 * @param template instance to be copied 073 * @return copy instance 074 */ 075 public static QueryTimedOutError of(final QueryTimedOutError template) { 076 QueryTimedOutErrorImpl instance = new QueryTimedOutErrorImpl(); 077 instance.setMessage(template.getMessage()); 078 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 079 return instance; 080 } 081 082 /** 083 * factory method to create a deep copy of QueryTimedOutError 084 * @param template instance to be copied 085 * @return copy instance 086 */ 087 @Nullable 088 public static QueryTimedOutError deepCopy(@Nullable final QueryTimedOutError template) { 089 if (template == null) { 090 return null; 091 } 092 QueryTimedOutErrorImpl instance = new QueryTimedOutErrorImpl(); 093 instance.setMessage(template.getMessage()); 094 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 095 return instance; 096 } 097 098 /** 099 * builder factory method for QueryTimedOutError 100 * @return builder 101 */ 102 public static QueryTimedOutErrorBuilder builder() { 103 return QueryTimedOutErrorBuilder.of(); 104 } 105 106 /** 107 * create builder for QueryTimedOutError instance 108 * @param template instance with prefilled values for the builder 109 * @return builder 110 */ 111 public static QueryTimedOutErrorBuilder builder(final QueryTimedOutError template) { 112 return QueryTimedOutErrorBuilder.of(template); 113 } 114 115 /** 116 * accessor map function 117 * @param <T> mapped type 118 * @param helper function to map the object 119 * @return mapped value 120 */ 121 default <T> T withQueryTimedOutError(Function<QueryTimedOutError, T> helper) { 122 return helper.apply(this); 123 } 124 125 /** 126 * gives a TypeReference for usage with Jackson DataBind 127 * @return TypeReference 128 */ 129 public static com.fasterxml.jackson.core.type.TypeReference<QueryTimedOutError> typeReference() { 130 return new com.fasterxml.jackson.core.type.TypeReference<QueryTimedOutError>() { 131 @Override 132 public String toString() { 133 return "TypeReference<QueryTimedOutError>"; 134 } 135 }; 136 } 137}