1 package org.oxerr.viagogo.model.response; 2 3 import java.io.Serializable; 4 import java.util.List; 5 6 import javax.annotation.CheckForNull; 7 8 import org.apache.commons.lang3.builder.EqualsBuilder; 9 import org.apache.commons.lang3.builder.HashCodeBuilder; 10 11 import io.openapitools.jackson.dataformat.hal.HALLink; 12 import io.openapitools.jackson.dataformat.hal.annotation.EmbeddedResource; 13 import io.openapitools.jackson.dataformat.hal.annotation.Link; 14 15 @io.openapitools.jackson.dataformat.hal.annotation.Resource 16 public class PagedResource<T extends Serializable> extends Resource { 17 18 private static final long serialVersionUID = 2023021301L; 19 20 private Integer totalItems; 21 22 private Integer page; 23 24 private Integer pageSize; 25 26 @EmbeddedResource 27 private List<T> deletedItems; 28 29 @EmbeddedResource 30 private List<T> items; 31 32 @Link("next") 33 private HALLink nextLink; 34 35 @Link("prev") 36 private HALLink prevLink; 37 38 @Link("first") 39 private HALLink firstLink; 40 41 @Link("last") 42 private HALLink lastLink; 43 44 public Integer getTotalItems() { 45 return totalItems; 46 } 47 48 public void setTotalItems(Integer totalItems) { 49 this.totalItems = totalItems; 50 } 51 52 public Integer getPage() { 53 return page; 54 } 55 56 public void setPage(Integer page) { 57 this.page = page; 58 } 59 60 public Integer getPageSize() { 61 return pageSize; 62 } 63 64 public void setPageSize(Integer pageSize) { 65 this.pageSize = pageSize; 66 } 67 68 public List<T> getDeletedItems() { 69 return deletedItems; 70 } 71 72 public void setDeletedItems(List<T> deletedItems) { 73 this.deletedItems = deletedItems; 74 } 75 76 public List<T> getItems() { 77 return items; 78 } 79 80 public void setItems(List<T> items) { 81 this.items = items; 82 } 83 84 @CheckForNull 85 public HALLink getNextLink() { 86 return nextLink; 87 } 88 89 public void setNextLink(HALLink nextLink) { 90 this.nextLink = nextLink; 91 } 92 93 @CheckForNull 94 public HALLink getPrevLink() { 95 return prevLink; 96 } 97 98 public void setPrevLink(HALLink prevLink) { 99 this.prevLink = prevLink; 100 } 101 102 @CheckForNull 103 public HALLink getFirstLink() { 104 return firstLink; 105 } 106 107 public void setFirstLink(HALLink firstLink) { 108 this.firstLink = firstLink; 109 } 110 111 @CheckForNull 112 public HALLink getLastLink() { 113 return lastLink; 114 } 115 116 public void setLastLink(HALLink lastLink) { 117 this.lastLink = lastLink; 118 } 119 120 @Override 121 public int hashCode() { 122 return HashCodeBuilder.reflectionHashCode(this); 123 } 124 125 @Override 126 public boolean equals(Object obj) { 127 if (this == obj) { 128 return true; 129 } 130 if (!(obj instanceof PagedResource)) { 131 return false; 132 } 133 @SuppressWarnings("unchecked") 134 PagedResource<T> rhs = (PagedResource<T>) obj; 135 return EqualsBuilder.reflectionEquals(this, rhs); 136 } 137 138 }