Annotation Type AssertLegal
Annotation to be placed on methods in commands or queries. After an aggregate is loaded and a
AggregateRoot
is returned you can pass the command or query to the Entity.assertLegal(java.lang.Object) method to assert whether or
not the command or query is allowed given the state of the model.
Annotated methods should contain at least one parameter. The first parameter is reserved for the Model's entity (as
obtained via Entity.get()).
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanDetermines if the legality check should be performed immediately (the default), or when the current handler is done, i.e.intDetermines the order of assertions if there are multiple annotated methods. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final int
-
Field Details
-
HIGHEST_PRIORITY
static final int HIGHEST_PRIORITY- See Also:
-
LOWEST_PRIORITY
static final int LOWEST_PRIORITY- See Also:
-
DEFAULT_PRIORITY
static final int DEFAULT_PRIORITY- See Also:
-
-
Element Details
-
priority
int priorityDetermines the order of assertions if there are multiple annotated methods. A method with higher priority will be invoked before methods with a lower priority. UseHIGHEST_PRIORITYto ensure that the check is performed first.- Default:
- 0
-
afterHandler
boolean afterHandlerDetermines if the legality check should be performed immediately (the default), or when the current handler is done, i.e. just before the aggregate updates are committed.- Default:
- false
-