Interface BeforeDeleteCallback<T>

All Superinterfaces:
EntityCallback<T>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface BeforeDeleteCallback<T> extends EntityCallback<T>
An EntityCallback that gets invoked before an entity is deleted. This callback gets only invoked if the method deleting the aggregate received an instance of that aggregate as an argument. Methods deleting entities by id or without any parameter don't invoke this callback.
Since:
1.1
Author:
Jens Schauder, Mark Paluch
  • Method Summary

    Modifier and Type
    Method
    Description
    onBeforeDelete(T aggregate, MutableAggregateChange<T> aggregateChange)
    Entity callback method invoked before an aggregate root is deleted.
  • Method Details

    • onBeforeDelete

      T onBeforeDelete(T aggregate, MutableAggregateChange<T> aggregateChange)
      Entity callback method invoked before an aggregate root is deleted. Can return either the same or a modified instance of the aggregate and can modify MutableAggregateChange contents. This method is called after converting the aggregate to MutableAggregateChange. Changes to the aggregate are not taken into account for deleting. Only transient fields of the entity should be changed in this callback.
      Parameters:
      aggregate - the aggregate.
      aggregateChange - the associated MutableAggregateChange.
      Returns:
      the aggregate to be deleted.