Code polishing.

This commit is contained in:
Oliver Gierke
2010-12-17 20:02:56 +01:00
parent 3d4f33d93c
commit 9b81171305
4 changed files with 31 additions and 6 deletions

View File

@@ -34,7 +34,11 @@ import com.mongodb.DBCursor;
*
* @author Oliver Gierke
*/
class MongoCursorUtils {
abstract class MongoCursorUtils {
private MongoCursorUtils() {
}
/**
* Creates a {@link CursorPreparer} applying the given {@link Pageable} to

View File

@@ -95,13 +95,25 @@ public class MongoQuery implements RepositoryQuery {
protected List<?> readCollection(DBObject query) {
return operations.query(operations.getDefaultCollectionName(), query,
method.getDomainClass());
return operations.query(operations.getDefaultCollectionName(),
query, method.getDomainClass());
}
}
/**
* {@link Execution} for collection returning queries.
*
* @author Oliver Gierke
*/
class CollectionExecution extends Execution {
/*
* (non-Javadoc)
*
* @see
* org.springframework.data.document.mongodb.repository.MongoQuery.Execution
* #execute(com.mongodb.DBObject)
*/
@Override
public Object execute(DBObject query) {
@@ -173,11 +185,17 @@ public class MongoQuery implements RepositoryQuery {
*/
class SingleEntityExecution extends Execution {
/*
* (non-Javadoc)
*
* @see
* org.springframework.data.document.mongodb.repository.MongoQuery.Execution
* #execute(com.mongodb.DBObject)
*/
@Override
Object execute(DBObject query) {
List<?> result = readCollection(query);
return result.isEmpty() ? null : result.get(0);
}
}

View File

@@ -108,7 +108,6 @@ class MongoQueryCreator extends AbstractQueryCreator<DBObject, QueryBuilder> {
@Override
protected DBObject finalize(QueryBuilder criteria, Sort sort) {
// TODO: apply sorting
return criteria.get();
}

View File

@@ -48,10 +48,14 @@ public class SimpleMongoRepository<T, ID extends Serializable> extends
/**
* Creates a ew {@link SimpleMongoRepository} for the given domain class and
* {@link MongoOperations}.
*
* @param domainClass
* @param operations
*/
public SimpleMongoRepository(Class<T> domainClass, MongoOperations operations) {
public SimpleMongoRepository(Class<T> domainClass,
MongoOperations operations) {
super(domainClass);