org.axonframework.domain
Interface AggregateRoot

All Known Subinterfaces:
EventSourcedAggregateRoot
All Known Implementing Classes:
AbstractAggregateRoot, AbstractAnnotatedAggregateRoot, AbstractEventSourcedAggregateRoot, AbstractJpaAggregateRoot

public interface AggregateRoot

Interface defining a contract for entities that represent the aggregate root.

Since:
0.1
Author:
Allard Buijze
See Also:
AbstractAggregateRoot

Method Summary
 void commitEvents()
          Clears the events currently marked as "uncommitted".
 AggregateIdentifier getIdentifier()
          Returns the identifier of this aggregate.
 int getUncommittedEventCount()
          Returns the number of uncommitted events currently available in the aggregate.
 DomainEventStream getUncommittedEvents()
          Returns a DomainEventStream to the events in the aggregate that have been raised since creation or the last commit.
 Long getVersion()
          Returns the current version number of the aggregate, or null if the aggregate is newly created.
 

Method Detail

getIdentifier

AggregateIdentifier getIdentifier()
Returns the identifier of this aggregate.

Returns:
the identifier of this aggregate

commitEvents

void commitEvents()
Clears the events currently marked as "uncommitted".


getUncommittedEventCount

int getUncommittedEventCount()
Returns the number of uncommitted events currently available in the aggregate.

Returns:
the number of uncommitted events currently available in the aggregate.

getUncommittedEvents

DomainEventStream getUncommittedEvents()
Returns a DomainEventStream to the events in the aggregate that have been raised since creation or the last commit.

Returns:
the DomainEventStream to the uncommitted events.

getVersion

Long getVersion()
Returns the current version number of the aggregate, or null if the aggregate is newly created. This version must reflect the version number of the aggregate on which changes are applied.

Each time the aggregate is modified and stored in a repository, the version number must be increased by at least 1. This version number can be used by optimistic locking strategies and detection of conflicting concurrent modification.

Typically the sequence number of the last committed event on this aggregate is used as version number.

Returns:
the current version number of this aggregate, or null if no events were ever committed


Copyright © 2011. All Rights Reserved.