Polished Resources abstraction.
Added correct equals(…)/hashCode() methods to PagedResource, PageMetadata. Polished toString() methods of ResourceSupport, Resource, Resources and PagedResources. Added factory method to PagedResources to easily create a plain instance from a set of entities.
This commit is contained in:
@@ -17,6 +17,8 @@ package org.springframework.hateoas;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.codehaus.jackson.annotate.JsonUnwrapped;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -25,6 +27,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@XmlRootElement
|
||||
public class Resource<T> extends ResourceSupport {
|
||||
|
||||
@JsonUnwrapped
|
||||
@@ -59,6 +62,15 @@ public class Resource<T> extends ResourceSupport {
|
||||
return content;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.hateoas.ResourceSupport#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("Resource { content: %s, %s }", getContent(), super.toString());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.hateoas.ResourceSupport#equals(java.lang.Object)
|
||||
|
||||
Reference in New Issue
Block a user