From 35ef9113ed32aaef29fb0c4d44a34d8b2c4a43e5 Mon Sep 17 00:00:00 2001 From: Steven van Beelen Date: Tue, 4 Aug 2020 10:55:03 +0200 Subject: [PATCH] Define some Aggregate specific annotations their scope changed The first mentions of the @AggregateIdentifier, @EntityId and @AggregateMember annotations should define these can be placed both on a field and on a method #framework-4.4-update --- .../axon-framework-commands/modeling/aggregate.md | 2 +- .../modeling/multi-entity-aggregates.md | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/axon-framework/axon-framework-commands/modeling/aggregate.md b/axon-framework/axon-framework-commands/modeling/aggregate.md index 43a238ee..03202094 100644 --- a/axon-framework/axon-framework-commands/modeling/aggregate.md +++ b/axon-framework/axon-framework-commands/modeling/aggregate.md @@ -39,8 +39,8 @@ public class GiftCard { There are a couple of noteworthy concepts from the given code snippets, marked with numbered Java comments referring to the following bullets: 1. The `@AggregateIdentifier` is the external reference point to into the `GiftCard` Aggregate. - This field is a hard requirement, as without it Axon will not know to which Aggregate a given Command is targeted. + Note that this annotation can be placed on a field and a method. 2. A `@CommandHandler` annotated constructor, or differently put the 'command handling constructor'. diff --git a/axon-framework/axon-framework-commands/modeling/multi-entity-aggregates.md b/axon-framework/axon-framework-commands/modeling/multi-entity-aggregates.md index 10b4e3f3..472b1aa1 100644 --- a/axon-framework/axon-framework-commands/modeling/multi-entity-aggregates.md +++ b/axon-framework/axon-framework-commands/modeling/multi-entity-aggregates.md @@ -50,24 +50,18 @@ public class GiftCardTransaction { Entities are, just like the aggregate root, simple objects, as is shown with the new `GiftCardTransaction` entity. The snippet above shows two important concepts of multi-entity aggregates: 1. The field that declares the child entity/entities must be annotated with `@AggregateMember`. - This annotation tells Axon that the annotated field contains a class that should be inspected for message handlers. - This example shows the annotation on an implementation of `Iterable`, but it can also be placed on a single Object or a `Map`. - In the latter case, the values of the `Map` are expected to contain the entities, while the key contains a value that is used as their reference. + Note that this annotation can be placed on a field and a method. 2. The `@EntityId` annotation specifying the identifying field of an Entity. - Required to be able to route a command \(or [event](multi-entity-aggregates.md#event-sourcing-handlers-in-entities)\) message to the correct entity instance. - The property on the payload that will be used to find the entity that the message should be routed to, defaults to the name of the `@EntityId` annotated field. - For example, when annotating the field `transactionId`, the command must define a property with that same name, which means either a `transactionId` or a `getTransactionId()` method must be present. - If the name of the field and the routing property differ, you may provide a value explicitly using `@EntityId(routingKey = "customRoutingProperty")`. - This annotation is **mandatory** on the Entity implementation if it will be part of a `Collection` or `Map` of child entities. + Note that this annotation can be placed on a field and a method. > **Defining the Entity type** >