001 002package com.commercetools.api.models.attribute_group; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007import java.util.stream.Collectors; 008 009import javax.annotation.Nullable; 010import javax.validation.Valid; 011import javax.validation.constraints.NotNull; 012 013import com.fasterxml.jackson.annotation.*; 014import com.fasterxml.jackson.databind.annotation.*; 015 016import io.vrap.rmf.base.client.utils.Generated; 017 018/** 019 * <p>PagedQueryResult with <code>results</code> containing an array of AttributeGroup.</p> 020 * 021 * <hr> 022 * Example to create an instance using the builder pattern 023 * <div class=code-example> 024 * <pre><code class='java'> 025 * AttributeGroupPagedQueryResponse attributeGroupPagedQueryResponse = AttributeGroupPagedQueryResponse.builder() 026 * .limit(0.3) 027 * .offset(0.3) 028 * .count(0.3) 029 * .plusResults(resultsBuilder -> resultsBuilder) 030 * .build() 031 * </code></pre> 032 * </div> 033 */ 034@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 035@JsonDeserialize(as = AttributeGroupPagedQueryResponseImpl.class) 036public interface AttributeGroupPagedQueryResponse 037 extends com.commercetools.api.models.ResourcePagedQueryResponse<AttributeGroup> { 038 039 /** 040 * <p>Number of results requested in the query request.</p> 041 * @return limit 042 */ 043 @NotNull 044 @JsonProperty("limit") 045 public Long getLimit(); 046 047 /** 048 * <p>Offset supplied by the client or the server default. It is the number of elements skipped, not a page number.</p> 049 * @return offset 050 */ 051 @NotNull 052 @JsonProperty("offset") 053 public Long getOffset(); 054 055 /** 056 * <p>Actual number of results returned.</p> 057 * @return count 058 */ 059 @NotNull 060 @JsonProperty("count") 061 public Long getCount(); 062 063 /** 064 * <p>Total number of results matching the query. This number is an estimation that is not strongly consistent. This field is returned by default. For improved performance, calculating this field can be deactivated by using the query parameter <code>withTotal=false</code>. When the results are filtered with a Query Predicate, <code>total</code> is subject to a limit.</p> 065 * @return total 066 */ 067 068 @JsonProperty("total") 069 public Long getTotal(); 070 071 /** 072 * <p>AttributeGroups matching the query.</p> 073 * @return results 074 */ 075 @NotNull 076 @Valid 077 @JsonProperty("results") 078 public List<AttributeGroup> getResults(); 079 080 /** 081 * <p>Number of results requested in the query request.</p> 082 * @param limit value to be set 083 */ 084 085 public void setLimit(final Long limit); 086 087 /** 088 * <p>Offset supplied by the client or the server default. It is the number of elements skipped, not a page number.</p> 089 * @param offset value to be set 090 */ 091 092 public void setOffset(final Long offset); 093 094 /** 095 * <p>Actual number of results returned.</p> 096 * @param count value to be set 097 */ 098 099 public void setCount(final Long count); 100 101 /** 102 * <p>Total number of results matching the query. This number is an estimation that is not strongly consistent. This field is returned by default. For improved performance, calculating this field can be deactivated by using the query parameter <code>withTotal=false</code>. When the results are filtered with a Query Predicate, <code>total</code> is subject to a limit.</p> 103 * @param total value to be set 104 */ 105 106 public void setTotal(final Long total); 107 108 /** 109 * <p>AttributeGroups matching the query.</p> 110 * @param results values to be set 111 */ 112 113 @JsonIgnore 114 public void setResults(final AttributeGroup... results); 115 116 /** 117 * <p>AttributeGroups matching the query.</p> 118 * @param results values to be set 119 */ 120 121 public void setResults(final List<AttributeGroup> results); 122 123 /** 124 * factory method 125 * @return instance of AttributeGroupPagedQueryResponse 126 */ 127 public static AttributeGroupPagedQueryResponse of() { 128 return new AttributeGroupPagedQueryResponseImpl(); 129 } 130 131 /** 132 * factory method to create a shallow copy AttributeGroupPagedQueryResponse 133 * @param template instance to be copied 134 * @return copy instance 135 */ 136 public static AttributeGroupPagedQueryResponse of(final AttributeGroupPagedQueryResponse template) { 137 AttributeGroupPagedQueryResponseImpl instance = new AttributeGroupPagedQueryResponseImpl(); 138 instance.setLimit(template.getLimit()); 139 instance.setOffset(template.getOffset()); 140 instance.setCount(template.getCount()); 141 instance.setTotal(template.getTotal()); 142 instance.setResults(template.getResults()); 143 return instance; 144 } 145 146 /** 147 * factory method to create a deep copy of AttributeGroupPagedQueryResponse 148 * @param template instance to be copied 149 * @return copy instance 150 */ 151 @Nullable 152 public static AttributeGroupPagedQueryResponse deepCopy(@Nullable final AttributeGroupPagedQueryResponse template) { 153 if (template == null) { 154 return null; 155 } 156 AttributeGroupPagedQueryResponseImpl instance = new AttributeGroupPagedQueryResponseImpl(); 157 instance.setLimit(template.getLimit()); 158 instance.setOffset(template.getOffset()); 159 instance.setCount(template.getCount()); 160 instance.setTotal(template.getTotal()); 161 instance.setResults(Optional.ofNullable(template.getResults()) 162 .map(t -> t.stream() 163 .map(com.commercetools.api.models.attribute_group.AttributeGroup::deepCopy) 164 .collect(Collectors.toList())) 165 .orElse(null)); 166 return instance; 167 } 168 169 /** 170 * builder factory method for AttributeGroupPagedQueryResponse 171 * @return builder 172 */ 173 public static AttributeGroupPagedQueryResponseBuilder builder() { 174 return AttributeGroupPagedQueryResponseBuilder.of(); 175 } 176 177 /** 178 * create builder for AttributeGroupPagedQueryResponse instance 179 * @param template instance with prefilled values for the builder 180 * @return builder 181 */ 182 public static AttributeGroupPagedQueryResponseBuilder builder(final AttributeGroupPagedQueryResponse template) { 183 return AttributeGroupPagedQueryResponseBuilder.of(template); 184 } 185 186 /** 187 * accessor map function 188 * @param <T> mapped type 189 * @param helper function to map the object 190 * @return mapped value 191 */ 192 default <T> T withAttributeGroupPagedQueryResponse(Function<AttributeGroupPagedQueryResponse, T> helper) { 193 return helper.apply(this); 194 } 195 196 /** 197 * gives a TypeReference for usage with Jackson DataBind 198 * @return TypeReference 199 */ 200 public static com.fasterxml.jackson.core.type.TypeReference<AttributeGroupPagedQueryResponse> typeReference() { 201 return new com.fasterxml.jackson.core.type.TypeReference<AttributeGroupPagedQueryResponse>() { 202 @Override 203 public String toString() { 204 return "TypeReference<AttributeGroupPagedQueryResponse>"; 205 } 206 }; 207 } 208}