org.springframework.data.document.mongodb.repository
Class SimpleMongoRepository<T,ID extends java.io.Serializable>

java.lang.Object
  extended by org.springframework.data.document.mongodb.repository.SimpleMongoRepository<T,ID>
Direct Known Subclasses:
QueryDslMongoRepository

public class SimpleMongoRepository<T,ID extends java.io.Serializable>
extends java.lang.Object

Repository base implementation for Mongo.

Author:
Oliver Gierke

Field Summary
private  MongoEntityInformation<T,ID> entityInformation
           
private  MongoTemplate template
           
 
Constructor Summary
SimpleMongoRepository(MongoEntityInformation<T,ID> metadata, MongoTemplate template)
          Creates a ew SimpleMongoRepository for the given MongoEntityInformation and MongoTemplate.
 
Method Summary
 long count()
           
 void delete(ID id)
           
 void delete(java.lang.Iterable<? extends T> entities)
           
 void delete(T entity)
           
 void deleteAll()
           
 boolean exists(ID id)
           
 java.util.List<T> findAll()
           
  findAll(Pageable pageable)
           
 java.util.List<T> findAll(Sort sort)
           
 T findOne(ID id)
           
protected  MongoEntityInformation<T,ID> getEntityInformation()
           
private  Criteria getIdCriteria(java.lang.Object id)
           
private  Query getIdQuery(java.lang.Object id)
           
protected  MongoOperations getMongoOperations()
          Returns the underlying MongoOperations instance.
 java.util.List<T> save(java.lang.Iterable<? extends T> entities)
           
 T save(T entity)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

template

private final MongoTemplate template

entityInformation

private final MongoEntityInformation<T,ID extends java.io.Serializable> entityInformation
Constructor Detail

SimpleMongoRepository

public SimpleMongoRepository(MongoEntityInformation<T,ID> metadata,
                             MongoTemplate template)
Creates a ew SimpleMongoRepository for the given MongoEntityInformation and MongoTemplate.

Parameters:
metadata -
template -
Method Detail

save

public T save(T entity)

save

public java.util.List<T> save(java.lang.Iterable<? extends T> entities)

findOne

public T findOne(ID id)

getIdQuery

private Query getIdQuery(java.lang.Object id)

getIdCriteria

private Criteria getIdCriteria(java.lang.Object id)

exists

public boolean exists(ID id)

count

public long count()

delete

public void delete(ID id)

delete

public void delete(T entity)

delete

public void delete(java.lang.Iterable<? extends T> entities)

deleteAll

public void deleteAll()

findAll

public java.util.List<T> findAll()

findAll

public  findAll(Pageable pageable)

findAll

public java.util.List<T> findAll(Sort sort)

getMongoOperations

protected MongoOperations getMongoOperations()
Returns the underlying MongoOperations instance.

Returns:

getEntityInformation

protected MongoEntityInformation<T,ID> getEntityInformation()
Returns:
the entityInformation