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
Link s to the resource. |
T |
add(Link... links)
Adds all given
Link s to the resource. |
T |
add(Link link)
Adds the given link to the resource.
|
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
Link s contained in this resource. |
List<Link> |
getLinks(LinkRelation relation)
Returns all
Link s with the given relation. |
List<Link> |
getLinks(String relation)
Returns all
Link s 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
Link s at all. |
T |
removeLinks()
Removes all
Link s added to the resource so far. |
String |
toString() |
public RepresentationModel()
public RepresentationModel(Link initialLink)
public T add(Link... links)
Link
s to the resource.links
- must not be null.public boolean hasLinks()
Link
s 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)
Link
s with the given relation.relation
- must not be null.List
public List<Link> getLinks(LinkRelation relation)
Link
s with the given relation.relation
- must not be null.List
Copyright © 2012-2019–2019 Pivotal, Inc.. All rights reserved.