Spring Hateoas

org.springframework.hateoas
Class ResourceSupport

java.lang.Object
  extended by org.springframework.hateoas.ResourceSupport
All Implemented Interfaces:
Identifiable<Link>
Direct Known Subclasses:
Resource, Resources, VndErrors.VndError

public class ResourceSupport
extends Object
implements Identifiable<Link>

Base class for DTOs to collect links.

Author:
Oliver Gierke

Constructor Summary
ResourceSupport()
           
 
Method Summary
 void add(Iterable<Link> links)
          Adds all given Links to the resource.
 void add(Link link)
          Adds the given link to the resource.
 boolean equals(Object obj)
           
 Link getId()
          Returns the Link with a rel of Link.REL_SELF.
 Link getLink(String rel)
          Returns the link with the given rel.
 List<Link> getLinks()
          Returns all Links contained in this resource.
 int hashCode()
           
 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.
 void removeLinks()
          Removes all Links added to the resource so far.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResourceSupport

public ResourceSupport()
Method Detail

getId

public Link getId()
Returns the Link with a rel of Link.REL_SELF.

Specified by:
getId in interface Identifiable<Link>
Returns:
the identifier or null if not available.

add

public void add(Link link)
Adds the given link to the resource.

Parameters:
link -

add

public void add(Iterable<Link> links)
Adds all given Links to the resource.

Parameters:
links -

hasLinks

public boolean hasLinks()
Returns whether the resource contains Links at all.

Returns:

hasLink

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

Parameters:
rel -
Returns:

getLinks

public List<Link> getLinks()
Returns all Links contained in this resource.

Returns:

removeLinks

public void removeLinks()
Removes all Links added to the resource so far.


getLink

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

Parameters:
rel -
Returns:
the link with the given rel or null if none found.

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
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.