Spring Hateoas

org.springframework.hateoas.client
Class Traverson

java.lang.Object
  extended by org.springframework.hateoas.client.Traverson

public class Traverson
extends Object

Component to ease traversing hypermedia APIs by following links with relation types. Highly inspired by the equally named JavaScript library.

Since:
0.11
Author:
Oliver Gierke, Dietrich Schulten
See Also:
https://github.com/basti1302/traverson

Nested Class Summary
 class Traverson.TraversalBuilder
          Builder API to customize traversals.
 
Constructor Summary
Traverson(URI baseUri, MediaType... mediaTypes)
          Creates a new Traverson interacting with the given base URI and using the given MediaTypes to interact with the service.
 
Method Summary
 Traverson.TraversalBuilder follow(String... rels)
          Sets up a Traverson.TraversalBuilder to follow the given rels.
 Traverson setLinkDiscoverers(List<? extends LinkDiscoverer> discoverer)
          Sets the LinkDiscoverers to use.
 Traverson setRestOperations(RestOperations operations)
          Configures the RestOperations to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Traverson

public Traverson(URI baseUri,
                 MediaType... mediaTypes)
Creates a new Traverson interacting with the given base URI and using the given MediaTypes to interact with the service.

Parameters:
baseUri - must not be null.
mediaType - must not be null or empty.
Method Detail

setRestOperations

public Traverson setRestOperations(RestOperations operations)
Configures the RestOperations to use. If null is provided a default RestTemplate will be used.

Parameters:
operations -
Returns:

setLinkDiscoverers

public Traverson setLinkDiscoverers(List<? extends LinkDiscoverer> discoverer)
Sets the LinkDiscoverers to use. By default a single HalLinkDiscoverer is registered. If null is provided the default is reapplied.

Parameters:
discoverer - can be null.
Returns:

follow

public Traverson.TraversalBuilder follow(String... rels)
Sets up a Traverson.TraversalBuilder to follow the given rels.

Parameters:
rels - must not be null or empty.
Returns:
See Also:
Traverson.TraversalBuilder

Spring Hateoas

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