Spring Hateoas

org.springframework.hateoas.core
Class JsonPathLinkDiscoverer

java.lang.Object
  extended by org.springframework.hateoas.core.JsonPathLinkDiscoverer
All Implemented Interfaces:
LinkDiscoverer
Direct Known Subclasses:
DefaultLinkDiscoverer, HalLinkDiscoverer

public class JsonPathLinkDiscoverer
extends Object
implements LinkDiscoverer

LinkDiscoverer that uses JsonPath to find links inside a representation.

Author:
Oliver Gierke

Constructor Summary
JsonPathLinkDiscoverer(String pathTemplate)
          Creates a new JsonPathLinkDiscoverer using the given path template.
 
Method Summary
 List<Link> findLinksWithRel(String rel, InputStream representation)
          Returns all links with the given relation type found in the given InputStream representation.
 List<Link> findLinksWithRel(String rel, String representation)
          Returns all links with the given relation type found in the given String representation.
 Link findLinkWithRel(String rel, InputStream representation)
          Finds a single link with the given relation type in the given InputStream representation.
 Link findLinkWithRel(String rel, String representation)
          Finds a single link with the given relation type in the given String representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonPathLinkDiscoverer

public JsonPathLinkDiscoverer(String pathTemplate)
Creates a new JsonPathLinkDiscoverer using the given path template. The template has to contain a single %s placeholder which will be replaced by the relation type.

Parameters:
pathTemplate - must not be null or empty and contain a single placeholder.
Method Detail

findLinkWithRel

public Link findLinkWithRel(String rel,
                            String representation)
Description copied from interface: LinkDiscoverer
Finds a single link with the given relation type in the given String representation.

Specified by:
findLinkWithRel in interface LinkDiscoverer
Parameters:
rel - must not be null or empty.
representation - must not be null or empty.
Returns:
the first link with the given relation type found, or null if none was found.

findLinkWithRel

public Link findLinkWithRel(String rel,
                            InputStream representation)
Description copied from interface: LinkDiscoverer
Finds a single link with the given relation type in the given InputStream representation.

Specified by:
findLinkWithRel in interface LinkDiscoverer
Parameters:
rel - must not be null or empty.
representation - must not be null or empty.
Returns:
the first link with the given relation type found, or null if none was found.

findLinksWithRel

public List<Link> findLinksWithRel(String rel,
                                   String representation)
Description copied from interface: LinkDiscoverer
Returns all links with the given relation type found in the given String representation.

Specified by:
findLinksWithRel in interface LinkDiscoverer
Parameters:
rel - must not be null or empty.
representation - must not be null or empty.
Returns:

findLinksWithRel

public List<Link> findLinksWithRel(String rel,
                                   InputStream representation)
Description copied from interface: LinkDiscoverer
Returns all links with the given relation type found in the given InputStream representation.

Specified by:
findLinksWithRel in interface LinkDiscoverer
Parameters:
rel - must not be null or empty.
representation - must not be null or empty.
Returns:

Spring Hateoas

Copyright © 2012-2013 SpringSource, a division of VMware. All Rights Reserved.