The payload of an event, the event object, carries any necessary state from the producer to the consumer and is nothing but an instance of a Java class.
We can assign qualifiers to an event and thus distinguish an event from other events of an event object type. These qualifiers act like selectors, narrowing the set of events that will be observed for an event object type.
There is no distinction between a qualifier of a bean type and that of an event, as they are both defined with @Qualifier
. This commonality provides a distinct advantage when using qualifiers to distinguish between bean types, as those same qualifiers can be used to distinguish between events where those bean types are the event objects.
An event qualifier is shown here:
@Qualifier @Target( { FIELD, PARAMETER } ) @Retention( RUNTIME ) public @interface Removed {}