public class PagedModel<T> extends CollectionModel<T>
Modifier and Type | Class and Description |
---|---|
static class |
PagedModel.PageMetadata
Value object for pagination metadata.
|
Modifier and Type | Field and Description |
---|---|
static PagedModel<?> |
NO_PAGE |
Modifier | Constructor and Description |
---|---|
protected |
PagedModel()
Default constructor to allow instantiation by reflection.
|
|
PagedModel(Collection<T> content,
PagedModel.PageMetadata metadata,
Iterable<Link> links)
|
|
PagedModel(Collection<T> content,
PagedModel.PageMetadata metadata,
Link... links)
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
PagedModel.PageMetadata |
getMetadata()
Returns the pagination metadata.
|
Optional<Link> |
getNextLink()
Returns the Link pointing to the next page (if set).
|
Optional<Link> |
getPreviousLink()
Returns the Link pointing to the previous page (if set).
|
int |
hashCode() |
String |
toString() |
static <T extends EntityModel<S>,S> |
wrap(Iterable<S> content,
PagedModel.PageMetadata metadata)
Factory method to easily create a
PagedModel instance from a set of entities and pagination metadata. |
getContent, iterator, wrap
add, add, add, addAllIf, addIf, getLink, getLink, getLinks, getLinks, getLinks, getRequiredLink, getRequiredLink, hasLink, hasLink, hasLinks, removeLinks
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static PagedModel<?> NO_PAGE
protected PagedModel()
public PagedModel(Collection<T> content, @Nullable PagedModel.PageMetadata metadata, Link... links)
content
- must not be null.metadata
- links
- public PagedModel(Collection<T> content, @Nullable PagedModel.PageMetadata metadata, Iterable<Link> links)
content
- must not be null.metadata
- links
- @Nullable public PagedModel.PageMetadata getMetadata()
public static <T extends EntityModel<S>,S> PagedModel<T> wrap(Iterable<S> content, PagedModel.PageMetadata metadata)
PagedModel
instance from a set of entities and pagination metadata.content
- must not be null.metadata
- public Optional<Link> getNextLink()
public Optional<Link> getPreviousLink()
public String toString()
toString
in class CollectionModel<T>
public boolean equals(@Nullable Object obj)
equals
in class CollectionModel<T>
public int hashCode()
hashCode
in class CollectionModel<T>
Copyright © 2011–2020 Pivotal, Inc.. All rights reserved.