#64 - Extended support for PagedResources.

Changed Relation type to identify previous links to standardized value of prev. Added integration tests for HAL rendering of PagedResources.
This commit is contained in:
Oliver Gierke
2013-05-15 17:48:51 +02:00
parent 17d91aca55
commit a9ccfc6782
6 changed files with 203 additions and 3 deletions

View File

@@ -42,7 +42,7 @@ public class Link implements Serializable {
public static final String REL_SELF = "self";
public static final String REL_FIRST = "first";
public static final String REL_PREVIOUS = "previous";
public static final String REL_PREVIOUS = "prev";
public static final String REL_NEXT = "next";
public static final String REL_LAST = "last";
@@ -101,6 +101,25 @@ public class Link implements Serializable {
return rel;
}
/**
* Returns a {@link Link} pointing to the same URI but with the given relation.
*
* @param rel must not be {@literal null} or empty.
* @return
*/
public Link withRel(String rel) {
return new Link(href, rel);
}
/**
* Returns a {@link Link} pointing to the same URI but with the {@code self} relation.
*
* @return
*/
public Link withSelfRel() {
return withRel(Link.REL_SELF);
}
/*
* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)