Hi all,
Here I want to implement a feature that undo the last action. Can I have a field of type DomainEvent like this?
Let the code speak:
public class AggregateRoot{
private DomainEvent lastEvent;
@EventHandler
protected void handle(XXEvent event) {
//change some other state
lastEvent = event;
}
public undo(){
if ( lastEvent instance of XXEvent){
//apply some specific event to revert the state
}
}
}
Keats