#9 - Added constructors taking Iterable<Link> to resource abstractions.

This commit is contained in:
Oliver Gierke
2012-08-23 23:57:13 +02:00
parent 7646e11a26
commit a4bf7fb4bf
3 changed files with 37 additions and 5 deletions

View File

@@ -41,16 +41,26 @@ public class Resource<T> extends ResourceSupport {
}
/**
* Creates a new {@link Resource} with the given content.
* Creates a new {@link Resource} with the given content and {@link Link}s (optional).
*
* @param content must not be {@literal null}.
* @param links the links to add to the {@link Resource}.
*/
public Resource(T content, Link... links) {
this(content, Arrays.asList(links));
}
/**
* Creates a new {@link Resource} with the given content and {@link Link}s.
*
* @param content must not be {@literal null}.
* @param links the links to add to the {@link Resource}.
*/
public Resource(T content, Iterable<Link> links) {
Assert.notNull(content, "Content must not be null!");
this.content = content;
this.add(Arrays.asList(links));
this.add(links);
}
/**