*/
@Override
public Link getSelfLinkFor(Object instance) {
Assert.notNull(instance, "Domain object must not be null!");
Repositories repositories = repositories(this);
Class instanceType = instance.getClass();
PersistentEntity<?, ?> entity = repositories.getPersistentEntity(instanceType);
if (entity == null) {
throw new IllegalArgumentException(String.format("Cannot create self link for %s! No persistent entity found!", instanceType));
}
EntityInformation<Object, Serializable> entityInformation = repositories.getEntityInformationFor(instanceType);
Serializable id = entityInformation.getId(instance);
return entityLinks(this).linkToSingleResource(entity.getType(), id).withSelfRel();
}