Spring Data Couchbase

org.springframework.data.couchbase.repository.support
Class SimpleCouchbaseRepository<T,ID extends Serializable>

java.lang.Object
  extended by org.springframework.data.couchbase.repository.support.SimpleCouchbaseRepository<T,ID>
All Implemented Interfaces:
CouchbaseRepository<T,ID>, CrudRepository<T,ID>, Repository<T,ID>

public class SimpleCouchbaseRepository<T,ID extends Serializable>
extends Object
implements CouchbaseRepository<T,ID>

Repository base implementation for Couchbase.

Author:
Michael Nitschinger

Constructor Summary
SimpleCouchbaseRepository(CouchbaseEntityInformation<T,String> metadata, CouchbaseOperations couchbaseOperations)
          Create a new Repository.
 
Method Summary
 long count()
           
 void delete(ID id)
           
 void delete(Iterable<? extends T> entities)
           
 void delete(T entity)
           
 void deleteAll()
           
 boolean exists(ID id)
           
 Iterable<T> findAll()
           
 Iterable<T> findAll(Iterable<ID> ids)
           
 T findOne(ID id)
           
protected  CouchbaseOperations getCouchbaseOperations()
          Returns the underlying operation template.
protected  CouchbaseEntityInformation<T,String> getEntityInformation()
          Returns the information for the underlying template.
<S extends T>
Iterable<S>
save(Iterable<S> entities)
           
<S extends T>
S
save(S entity)
           
 void setViewMetadataProvider(ViewMetadataProvider viewMetadataProvider)
          Configures a custom ViewMetadataProvider to be used to detect Views to be applied to queries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleCouchbaseRepository

public SimpleCouchbaseRepository(CouchbaseEntityInformation<T,String> metadata,
                                 CouchbaseOperations couchbaseOperations)
Create a new Repository.

Parameters:
metadata - the Metadata for the entity.
couchbaseOperations - the reference to the template used.
Method Detail

setViewMetadataProvider

public void setViewMetadataProvider(ViewMetadataProvider viewMetadataProvider)
Configures a custom ViewMetadataProvider to be used to detect Views to be applied to queries.

Parameters:
viewMetadataProvider - that is used to lookup any annotated View on a query method.

save

public <S extends T> S save(S entity)
Specified by:
save in interface CrudRepository<T,ID extends Serializable>

save

public <S extends T> Iterable<S> save(Iterable<S> entities)
Specified by:
save in interface CrudRepository<T,ID extends Serializable>

findOne

public T findOne(ID id)
Specified by:
findOne in interface CrudRepository<T,ID extends Serializable>

exists

public boolean exists(ID id)
Specified by:
exists in interface CrudRepository<T,ID extends Serializable>

delete

public void delete(ID id)
Specified by:
delete in interface CrudRepository<T,ID extends Serializable>

delete

public void delete(T entity)
Specified by:
delete in interface CrudRepository<T,ID extends Serializable>

delete

public void delete(Iterable<? extends T> entities)
Specified by:
delete in interface CrudRepository<T,ID extends Serializable>

findAll

public Iterable<T> findAll()
Specified by:
findAll in interface CrudRepository<T,ID extends Serializable>

findAll

public Iterable<T> findAll(Iterable<ID> ids)
Specified by:
findAll in interface CrudRepository<T,ID extends Serializable>

count

public long count()
Specified by:
count in interface CrudRepository<T,ID extends Serializable>

deleteAll

public void deleteAll()
Specified by:
deleteAll in interface CrudRepository<T,ID extends Serializable>

getCouchbaseOperations

protected CouchbaseOperations getCouchbaseOperations()
Returns the underlying operation template.

Returns:
the underlying template.

getEntityInformation

protected CouchbaseEntityInformation<T,String> getEntityInformation()
Returns the information for the underlying template.

Returns:
the underlying entity information.

Spring Data Couchbase

Copyright © 2011-2014–2014 Pivotal Software, Inc.. All rights reserved.