A - the type of the aggregate root class.K - the type of the aggregate root class.@DomainRepository public interface Repository<A extends AggregateRoot<K>,K>
To be a valid repository interface, Type must respect the followings:
Repository
public interface ProductRepository extends Repository<Product,String> {
// nothing needed, but you can add methods with specifics
// then implements them
}
Then this interface has to be implemented by the actual repository implementation.
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Deletes all aggregates from the persistence.
|
long |
count()
Returns the number of aggregates managed by this repository.
|
void |
delete(A aggregate)
Deletes an aggregate instance from the persistence.
|
void |
delete(K id)
Deletes an aggregate from the persistence by its key.
|
boolean |
exists(K id)
Check that the aggregate identified by the specified key exists.
|
Class<A> |
getAggregateRootClass() |
Class<K> |
getKeyClass() |
A |
load(K id)
Loads an aggregate from the persistence by its key.
|
void |
persist(A aggregate)
Creates an aggregate in the persistence.
|
A |
save(A aggregate)
Updates an aggregate in the persistence
|
@Read A load(K id)
id - the aggregate key@Read boolean exists(K id)
id - the aggregate key@Read long count()
@Delete void clear()
@Delete void delete(K id)
id - the aggregate key@Delete void delete(A aggregate)
aggregate - the aggregate to delete@Persist void persist(A aggregate)
aggregate - the aggregate to persist@Persist A save(A aggregate)
aggregate - the aggregate to saveCopyright © 2013-2016–2016 SeedStack. All rights reserved.