Example usage for org.springframework.hateoas Link withSelfRel

List of usage examples for org.springframework.hateoas Link withSelfRel

Introduction

In this page you can find the example usage for org.springframework.hateoas Link withSelfRel.

Prototype

public Link withSelfRel() 

Source Link

Document

Returns a Link pointing to the same URI but with the self relation.

Usage

From source file:com.ucrisko.libroomreserve.rest.resources.asm.UserResourceAsm.java

@Override
public UserResource toResource(User user) {
    UserResource userResource = new UserResource();
    userResource.setUserId(user.getUserId());
    userResource.setUserName(user.getUserName());

    //HATEOAS link builder object
    Link link = linkTo(methodOn(UserController.class).getUser(user.getUserId())).withSelfRel();
    userResource.add(link.withSelfRel());

    return userResource;
}