T
- The type of aggregate this repository stores.public interface Repository<T> extends ScopeAware
Modifier and Type | Method and Description |
---|---|
Aggregate<T> |
load(String aggregateIdentifier)
Load the aggregate with the given unique identifier.
|
Aggregate<T> |
load(String aggregateIdentifier,
Long expectedVersion)
Load the aggregate with the given unique identifier.
|
default Aggregate<T> |
loadOrCreate(String aggregateIdentifier,
Callable<T> factoryMethod)
Loads an aggregate from the repository.
|
Aggregate<T> |
newInstance(Callable<T> factoryMethod)
Creates a new managed instance for the aggregate, using the given
factoryMethod
to instantiate the aggregate's root. |
canResolve, send
Aggregate<T> load(String aggregateIdentifier)
aggregateIdentifier
- The identifier of the aggregate to loadAggregateNotFoundException
- if aggregate with given id cannot be foundAggregate<T> load(String aggregateIdentifier, Long expectedVersion)
aggregateIdentifier
- The identifier of the aggregate to loadexpectedVersion
- The expected version of the loaded aggregateAggregateNotFoundException
- if aggregate with given id cannot be foundAggregate<T> newInstance(Callable<T> factoryMethod) throws Exception
factoryMethod
to instantiate the aggregate's root.factoryMethod
- The method to create the aggregate's root instanceException
- when the factoryMethod throws an exceptiondefault Aggregate<T> loadOrCreate(String aggregateIdentifier, Callable<T> factoryMethod) throws Exception
factoryMethod
.aggregateIdentifier
- The identifier of the aggregate to loadfactoryMethod
- The method to create the aggregate's root instanceException
Copyright © 2010–2020. All rights reserved.