public abstract class BaseInMemoryRepository<A extends AggregateRoot<I>,I> extends BaseRepository<A,I>
Repository
. It is
backed by a ConcurrentHashMap
per aggregate root class. As such,
insertion order is NOT guaranteed to be maintained through the repository
lifecycle.Repository.Option
Modifier | Constructor and Description |
---|---|
protected |
BaseInMemoryRepository()
Creates a base in-memory repository.
|
protected |
BaseInMemoryRepository(Class<A> aggregateRootClass,
Class<I> idClass)
Creates a base in-memory repository.
|
Modifier and Type | Method and Description |
---|---|
void |
add(A a)
Adds an aggregate to the repository.
|
Stream<A> |
get(Specification<A> specification,
Repository.Option... options)
Finds all aggregates in the repository satisfying the given specification.
|
long |
remove(Specification<A> specification)
Removes all aggregates in the repository satisfying the given specification.
|
getAggregateRootClass, getIdentifierClass, getSpecificationBuilder
protected BaseInMemoryRepository()
protected BaseInMemoryRepository(Class<A> aggregateRootClass, Class<I> idClass)
aggregateRootClass
- the actual aggregate root class.idClass
- the actual aggregate identifier class.public void add(A a) throws AggregateExistsException
Repository
a
- the aggregate to add.AggregateExistsException
- if the repository already contains the aggregate.public Stream<A> get(Specification<A> specification, Repository.Option... options)
Repository
specification
- the specification aggregates must satisfy.options
- result options.Repository.Option
public long remove(Specification<A> specification)
Repository
specification
- the specification aggregates must satisfy.Copyright © 2013-2018–2019 SeedStack. All rights reserved.