Spring Hateoas

org.springframework.hateoas
Class Links

java.lang.Object
  extended by org.springframework.hateoas.Links
All Implemented Interfaces:
Iterable<Link>

public class Links
extends Object
implements Iterable<Link>

Value object to represent a list of Links.

Author:
Oliver Gierke

Constructor Summary
Links(Link... links)
          Creates a new Links instance from the given Links.
Links(List<Link> links)
          Creates a new Links instance from the given Links.
 
Method Summary
 boolean equals(Object arg0)
           
 Link getLink(String rel)
          Returns the Link with the given rel.
 List<Link> getLinks(String rel)
          Returns all Links with the given relation type.
 int hashCode()
           
 boolean hasLink(String rel)
          Returns whether the Links container contains a Link with the given rel.
 boolean isEmpty()
          Returns whether the Links containter is empty.
 Iterator<Link> iterator()
           
 String toString()
           
static Links valueOf(String source)
          Creates a Links instance from the given RFC5988-compatible link format.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Links

public Links(List<Link> links)
Creates a new Links instance from the given Links.

Parameters:
links -

Links

public Links(Link... links)
Creates a new Links instance from the given Links.

Parameters:
links -
Method Detail

getLink

public Link getLink(String rel)
Returns the Link with the given rel.

Parameters:
rel - the relation type to lookup a link for.
Returns:
the Link with the given rel or null if none found.

getLinks

public List<Link> getLinks(String rel)
Returns all Links with the given relation type.

Returns:
the links

hasLink

public boolean hasLink(String rel)
Returns whether the Links container contains a Link with the given rel.

Parameters:
rel -
Returns:

valueOf

public static Links valueOf(String source)
Creates a Links instance from the given RFC5988-compatible link format.

Parameters:
source - a comma separated list of Link representations.
Returns:
the Links represented by the given String.

isEmpty

public boolean isEmpty()
Returns whether the Links containter is empty.

Returns:

toString

public String toString()
Overrides:
toString in class Object

iterator

public Iterator<Link> iterator()
Specified by:
iterator in interface Iterable<Link>

equals

public boolean equals(Object arg0)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

Spring Hateoas

Copyright © 2012-2014–2014 Pivotal, Inc.. All rights reserved.