#1241 - Additional factory methods for CollectionModel and PagedModel.

Added overloads of ….empty() to allow adding links right on construction.
This commit is contained in:
Oliver Drotbohm
2020-03-27 14:52:19 +01:00
parent 8f98519e07
commit 6c09839cca
2 changed files with 77 additions and 2 deletions

View File

@@ -81,11 +81,36 @@ public class CollectionModel<T> extends RepresentationModel<CollectionModel<T>>
*
* @param <T>
* @return
* @since 1.1
*/
public static <T> CollectionModel<T> empty() {
return of(Collections.emptyList());
}
/**
* Creates a new empty collection model with the given links.
*
* @param <T>
* @param links must not be {@literal null}.
* @return
* @since 1.1
*/
public static <T> CollectionModel<T> empty(Link... links) {
return of(Collections.emptyList(), links);
}
/**
* Creates a new empty collection model with the given links.
*
* @param <T>
* @param links must not be {@literal null}.
* @return
* @since 1.1
*/
public static <T> CollectionModel<T> empty(Iterable<Link> links) {
return of(Collections.emptyList(), links);
}
/**
* Creates a {@link CollectionModel} instance with the given content.
*