DATACMNS-21 - Override Repository methods returning Iterable.

As the MongoOperations currently only returns Lists anyway we can override the methods returning an Iterable to return List for now.
This commit is contained in:
Oliver Gierke
2011-03-11 19:01:05 +01:00
parent f585beffc8
commit d824ed7e72
2 changed files with 21 additions and 7 deletions

View File

@@ -16,16 +16,31 @@
package org.springframework.data.document.mongodb.repository;
import java.io.Serializable;
import java.util.List;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
* Mongo specific {@link org.springframework.data.repository.Repository} interface.
*
* @author Oliver Gierke
*/
public interface MongoRepository<T, ID extends Serializable> extends
PagingAndSortingRepository<T, ID> {
public interface MongoRepository<T, ID extends Serializable> extends PagingAndSortingRepository<T, ID> {
/*
* (non-Javadoc)
*
* @see org.springframework.data.repository.Repository#findAll()
*/
@Override
List<T> findAll();
/*
* (non-Javadoc)
*
* @see org.springframework.data.repository.PagingAndSortingRepository#findAll(org.springframework.data.domain.Sort)
*/
@Override
List<T> findAll(Sort sort);
}

View File

@@ -30,7 +30,6 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.util.Assert;
/**
@@ -38,13 +37,13 @@ import org.springframework.util.Assert;
*
* @author Oliver Gierke
*/
public class SimpleMongoRepository<T, ID extends Serializable> implements PagingAndSortingRepository<T, ID> {
public class SimpleMongoRepository<T, ID extends Serializable> implements MongoRepository<T, ID> {
private final MongoTemplate template;
private final MongoEntityInformation<T, ID> entityInformation;
/**
* Creates a ew {@link SimpleMongoRepository} for the given {@link MongoInformation} and {@link MongoTemplate}.
* Creates a new {@link SimpleMongoRepository} for the given {@link MongoInformation} and {@link MongoTemplate}.
*
* @param metadata
* @param template
@@ -73,7 +72,7 @@ public class SimpleMongoRepository<T, ID extends Serializable> implements Paging
*
* @see org.springframework.data.repository.Repository#save(java.lang.Iterable)
*/
public List<T> save(Iterable<? extends T> entities) {
public Iterable<T> save(Iterable<? extends T> entities) {
List<T> result = new ArrayList<T>();