Spring Hateoas

org.springframework.hateoas.mvc
Class ControllerLinkBuilder

java.lang.Object
  extended by org.springframework.hateoas.mvc.ControllerLinkBuilder

public class ControllerLinkBuilder
extends Object

Builder to ease building Link instances pointing to Spring MVC controllers.

Author:
Oliver Gierke

Method Summary
static ControllerLinkBuilder linkTo(Class<?> controller)
          Creates a new ControllerLinkBuilder with a base of the mapping annotated to the given controller class.
static ControllerLinkBuilder linkTo(Class<?> controller, Object... parameters)
           
 ControllerLinkBuilder slash(Identifiable<?> identifyable)
          Adds the given AbstractEntity's id as sub-resource.
 ControllerLinkBuilder slash(Object object)
          Adds the given object's String representation as sub-resource to the current URI.
 String toString()
           
 URI toUri()
          Returns a URI resulting from the uriComponents.
 Link withRel(String rel)
           
 Link withSelfRel()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

linkTo

public static ControllerLinkBuilder linkTo(Class<?> controller)
Creates a new ControllerLinkBuilder with a base of the mapping annotated to the given controller class.

Parameters:
controller -
Returns:

linkTo

public static ControllerLinkBuilder linkTo(Class<?> controller,
                                           Object... parameters)

slash

public ControllerLinkBuilder slash(Object object)
Adds the given object's String representation as sub-resource to the current URI.

Parameters:
object -
Returns:

slash

public ControllerLinkBuilder slash(Identifiable<?> identifyable)
Adds the given AbstractEntity's id as sub-resource. Will simply return the current uriComponents if the given entity is null.

Parameters:
identifyable -
Returns:

toUri

public URI toUri()
Returns a URI resulting from the uriComponents.

Returns:

withRel

public Link withRel(String rel)

withSelfRel

public Link withSelfRel()

toString

public String toString()
Overrides:
toString in class Object

Spring Hateoas

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