Added assertions based on EntityLinks interface.

This commit is contained in:
Oliver Gierke
2012-11-18 18:57:43 +01:00
parent 40b486cb43
commit a1b706c21c

View File

@@ -19,6 +19,7 @@ import org.springframework.hateoas.EntityLinks;
import org.springframework.hateoas.Identifiable;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.LinkBuilder;
import org.springframework.util.Assert;
/**
* Implementation base class to delegate the higher level methods of {@link EntityLinks} by delegating to the more fine
@@ -34,6 +35,7 @@ public abstract class AbstractEntityLinks implements EntityLinks {
*/
@Override
public Link linkToSingleResource(Identifiable<?> entity) {
Assert.notNull(entity);
return linkToSingleResource(entity.getClass(), entity.getId());
}
@@ -52,6 +54,7 @@ public abstract class AbstractEntityLinks implements EntityLinks {
*/
@Override
public LinkBuilder linkForSingleResource(Identifiable<?> entity) {
Assert.notNull(entity);
return linkForSingleResource(entity.getClass(), entity.getId());
}
}