Interface Repository<ID extends AggregateRootId,​T extends AggregateRoot<ID>>

  • Type Parameters:
    ID - Type of the aggregate root identifier.
    T - Type of the aggregate.
    All Known Implementing Classes:
    EventStoreRepository

    public interface Repository<ID extends AggregateRootId,​T extends AggregateRoot<ID>>
    Repository that supports CRUD operations for an aggregate.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void add​(T aggregate)
      Adds a new aggregate to the repository without any meta data.
      void add​(T aggregate, String metaType, Object metaData)
      Adds a new aggregate to the repository with some meta data.
      T create()
      Factory method to create a new aggregate.
      void delete​(ID aggregateId, int expectedVersion)
      Deletes an aggregate from the repository.
      @NotNull Class<T> getAggregateClass()
      Returns the class of the aggregate in the repository.
      @NotNull EntityType getAggregateType()
      Returns a unique name for the aggregate root type.
      T read​(ID id)
      Reads the latest version of an aggregate.
      T read​(ID id, int version)
      Reads a given version of an aggregate.
      void update​(T aggregate)
      Saves the changes on an aggregate in the repository without any meta data.
      void update​(T aggregate, String metaType, Object metaData)
      Saves the changes on an aggregate in the repository including some meta data.