public class CollectionModel<T> extends RepresentationModel<CollectionModel<T>> implements Iterable<T>, ResolvableTypeProvider
| Modifier | Constructor and Description |
|---|---|
protected |
CollectionModel()
Creates an empty
CollectionModel instance. |
protected |
CollectionModel(Iterable<T> content) |
protected |
CollectionModel(Iterable<T> content,
Iterable<Link> links,
ResolvableType fallbackType) |
| Modifier and Type | Method and Description |
|---|---|
static <T> CollectionModel<T> |
empty()
Creates a new empty collection model.
|
static <T> CollectionModel<T> |
empty(Class<T> elementType,
Class<?>... generics)
Creates a new empty collection model with the given type defined as fallback type.
|
static <T> CollectionModel<T> |
empty(Iterable<Link> links)
Creates a new empty collection model with the given links.
|
static <T> CollectionModel<T> |
empty(Link... links)
Creates a new empty collection model with the given links.
|
static <T> CollectionModel<T> |
empty(ParameterizedTypeReference<T> type)
Creates a new empty collection model with the given type defined as fallback type.
|
static <T> CollectionModel<T> |
empty(ResolvableType elementType)
Creates a new empty collection model with the given type defined as fallback type.
|
boolean |
equals(Object obj) |
Collection<T> |
getContent()
Returns the underlying elements.
|
ResolvableType |
getResolvableType() |
int |
hashCode() |
Iterator<T> |
iterator() |
static <T> CollectionModel<T> |
of(Iterable<T> content)
Creates a
CollectionModel instance with the given content. |
static <T> CollectionModel<T> |
of(Iterable<T> content,
Iterable<Link> links)
s Creates a
CollectionModel instance with the given content and Links. |
static <T> CollectionModel<T> |
of(Iterable<T> content,
Link... links)
Creates a
CollectionModel instance with the given content and Links (optional). |
String |
toString() |
CollectionModel<T> |
withFallbackType(Class<? super T> type,
Class<?>... generics)
Declares the given type as fallback element type in case the underlying collection is empty.
|
CollectionModel<T> |
withFallbackType(ParameterizedTypeReference<?> type)
Declares the given type as fallback element type in case the underlying collection is empty.
|
CollectionModel<T> |
withFallbackType(ResolvableType type)
Declares the given type as fallback element type in case the underlying collection is empty.
|
static <T extends EntityModel<S>,S> |
wrap(Iterable<S> content)
Creates a new
CollectionModel instance by wrapping the given domain class instances into a
EntityModel. |
add, add, add, addAllIf, addIf, getLink, getLink, getLinks, getLinks, getLinks, getRequiredLink, getRequiredLink, hasLink, hasLink, hasLinks, mapLink, mapLinkIf, removeLinksclone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorprotected CollectionModel()
CollectionModel instance.public static <T> CollectionModel<T> empty()
T - public static <T> CollectionModel<T> empty(Class<T> elementType, Class<?>... generics)
T - withFallbackType(Class, Class...)public static <T> CollectionModel<T> empty(ParameterizedTypeReference<T> type)
T - withFallbackType(ParameterizedTypeReference)public static <T> CollectionModel<T> empty(ResolvableType elementType)
T - withFallbackType(ResolvableType)public static <T> CollectionModel<T> empty(Link... links)
T - links - must not be null.public static <T> CollectionModel<T> empty(Iterable<Link> links)
T - links - must not be null.public static <T> CollectionModel<T> of(Iterable<T> content)
CollectionModel instance with the given content.content - must not be null.withFallbackType(Class, Class...),
withFallbackType(ResolvableType)public static <T> CollectionModel<T> of(Iterable<T> content, Link... links)
CollectionModel instance with the given content and Links (optional).content - must not be null.links - the links to be added to the CollectionModel.withFallbackType(Class, Class...),
withFallbackType(ResolvableType)public static <T> CollectionModel<T> of(Iterable<T> content, Iterable<Link> links)
CollectionModel instance with the given content and Links.content - must not be null.links - the links to be added to the CollectionModel.withFallbackType(Class, Class...),
withFallbackType(ResolvableType)public static <T extends EntityModel<S>,S> CollectionModel<T> wrap(Iterable<S> content)
CollectionModel instance by wrapping the given domain class instances into a
EntityModel.content - must not be null.public Collection<T> getContent()
public CollectionModel<T> withFallbackType(Class<? super T> type, Class<?>... generics)
type - must not be null.public CollectionModel<T> withFallbackType(ParameterizedTypeReference<?> type)
type - must not be null.public CollectionModel<T> withFallbackType(ResolvableType type)
type - must not be null.@NonNull public ResolvableType getResolvableType()
getResolvableType in interface ResolvableTypeProviderpublic String toString()
toString in class RepresentationModel<CollectionModel<T>>public boolean equals(@Nullable Object obj)
equals in class RepresentationModel<CollectionModel<T>>public int hashCode()
hashCode in class RepresentationModel<CollectionModel<T>>Copyright © 2011–2021 Pivotal, Inc.. All rights reserved.