public class RepresentationModel<T extends RepresentationModel<? extends T>> extends Object
| Constructor and Description |
|---|
RepresentationModel() |
RepresentationModel(Link initialLink) |
RepresentationModel(List<Link> initialLinks) |
| Modifier and Type | Method and Description |
|---|---|
T |
add(Iterable<Link> links)
Adds all given
Links to the resource. |
T |
add(Link... links)
Adds all given
Links to the resource. |
T |
add(Link link)
Adds the given link to the resource.
|
T |
addAllIf(boolean guard,
Supplier<? extends Iterable<Link>> links)
Adds all
Links produced by the given Supplier if the guard is true. |
T |
addIf(boolean guard,
Supplier<Link> link)
Adds the
Link produced by the given Supplier if the guard is true. |
boolean |
equals(Object obj) |
Optional<Link> |
getLink(LinkRelation relation)
Returns the link with the given
LinkRelation. |
Optional<Link> |
getLink(String relation)
Returns the link with the given relation.
|
Links |
getLinks()
Returns all
Links contained in this resource. |
List<Link> |
getLinks(LinkRelation relation)
Returns all
Links with the given relation. |
List<Link> |
getLinks(String relation)
Returns all
Links with the given relation. |
Link |
getRequiredLink(LinkRelation relation)
Returns the link with the given relation.
|
Link |
getRequiredLink(String relation)
Returns the link with the given relation.
|
int |
hashCode() |
boolean |
hasLink(LinkRelation rel) |
boolean |
hasLink(String rel)
Returns whether the resource contains a
Link with the given rel. |
boolean |
hasLinks()
Returns whether the resource contains
Links at all. |
T |
removeLinks()
Removes all
Links added to the resource so far. |
String |
toString() |
public RepresentationModel()
public RepresentationModel(Link initialLink)
public T add(Iterable<Link> links)
Links to the resource.links - must not be null.Linkspublic T add(Link... links)
Links to the resource.links - must not be null.public T addIf(boolean guard, Supplier<Link> link)
Link produced by the given Supplier if the guard is true.public T addAllIf(boolean guard, Supplier<? extends Iterable<Link>> links)
Links produced by the given Supplier if the guard is true.public boolean hasLinks()
Links at all.public boolean hasLink(String rel)
Link with the given rel.rel - public boolean hasLink(LinkRelation rel)
public Optional<Link> getLink(String relation)
relation - must not be null or empty.Optional.empty() if none found.public Optional<Link> getLink(LinkRelation relation)
LinkRelation.relation - public Link getRequiredLink(String relation)
relation - must not be null or empty.IllegalArgumentException - in case no link with the given relation can be found.public Link getRequiredLink(LinkRelation relation)
relation - must not be null.IllegalArgumentException - in case no link with the given relation can be found.public List<Link> getLinks(String relation)
Links with the given relation.relation - must not be null.Listpublic List<Link> getLinks(LinkRelation relation)
Links with the given relation.relation - must not be null.ListCopyright © 2012-2019–2019 Pivotal, Inc.. All rights reserved.