#566 - Introduced ResourceSupport.getLinks(…) to return all with a given rel.

Related tickets: #542, #318, #319, #157.
This commit is contained in:
Greg Turnquist
2017-03-22 13:31:29 -05:00
committed by Oliver Gierke
parent 85682ea57f
commit aafe1f2d63
2 changed files with 37 additions and 0 deletions

View File

@@ -133,6 +133,24 @@ public class ResourceSupport implements Identifiable<Link> {
return null;
}
/**
* Returns all {@link Link}s with the given relation type.
*
* @return the links in a {@link List}
*/
public List<Link> getLinks(String rel) {
List<Link> relatedLinks = new ArrayList<Link>();
for (Link link : links) {
if (link.getRel().equals(rel)) {
relatedLinks.add(link);
}
}
return relatedLinks;
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()