A - Aggregate root class.ID - Identifier class.public abstract class BaseMorphiaRepository<A extends AggregateRoot<ID>,ID> extends BaseRepository<A,ID>
getDatastore() ()} protected method.Repository.Option| Constructor and Description |
|---|
BaseMorphiaRepository() |
BaseMorphiaRepository(Class<A> aggregateRootClass,
Class<ID> kClass) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(A aggregate)
Adds an aggregate to the repository.
|
A |
addOrUpdate(A aggregate)
Adds an aggregate to the repository or updates it if it already exists.
|
void |
clear()
Removes all aggregates from the repository.
|
boolean |
contains(ID id)
Checks that the aggregate identified by the specified identifier is present in the repository.
|
boolean |
contains(Specification<A> specification)
Check if at least one aggregate satisfying the specified specification is present in the
repository.
|
long |
count(Specification<A> specification)
Count the number of aggregates in the repository satisfying the given specification.
|
Optional<A> |
get(ID id)
Gets an aggregate identified by its identifier.
|
Stream<A> |
get(Specification<A> specification,
Repository.Option... options)
Finds all aggregates in the repository satisfying the given specification.
|
protected org.mongodb.morphia.Datastore |
getDatastore()
Provides access to the Morphia data store for implementing custom data access methods.
|
void |
remove(ID id)
Removes the existing aggregate identified with the specified identifier.
|
long |
remove(Specification<A> specification)
Removes all aggregates in the repository satisfying the given specification.
|
long |
size()
Returns the number of aggregates in the repository.
|
A |
update(A aggregate)
Updates an existing aggregate with the specified instance.
|
getAggregateRootClass, getIdentifierClass, getSpecificationBuilderclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcontains, isEmpty, removeprotected org.mongodb.morphia.Datastore getDatastore()
public void add(A aggregate) throws AggregateExistsException
Repositoryaggregate - the aggregate to add.AggregateExistsException - if the repository already contains the aggregate.public Stream<A> get(Specification<A> specification, Repository.Option... options)
Repositoryspecification - the specification aggregates must satisfy.options - result options.Repository.Optionpublic Optional<A> get(ID id)
Repositoryid - the aggregate identifier.public boolean contains(Specification<A> specification)
Repositoryspecification - the specification.public boolean contains(ID id)
Repositoryid - the aggregate identifier.public long count(Specification<A> specification)
Repositoryspecification - the specification aggregates must satisfy.public long size()
Repositorypublic long remove(Specification<A> specification) throws AggregateNotFoundException
Repositoryspecification - the specification aggregates must satisfy.AggregateNotFoundException - if the repository doesn't contain the aggregate.public void remove(ID id) throws AggregateNotFoundException
Repositoryid - the identifier of the aggregate to remove.AggregateNotFoundException - if the repository doesn't contain the aggregate.public A update(A aggregate) throws AggregateNotFoundException
Repositoryaggregate - the aggregate to update.AggregateNotFoundException - if the repository doesn't contain the aggregate.public A addOrUpdate(A aggregate)
RepositoryRepository.add(A) and Repository.update(AggregateRoot) should
be preferred.aggregate - the aggregate to update.public void clear()
RepositoryCopyright © 2013-2018–2019 SeedStack. All rights reserved.