Skip to content

Commit

Permalink
Change events delivery
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Pinčuk <alexander.v.pinchuk@gmail.com>
  • Loading branch information
avpinchuk committed Mar 14, 2024
1 parent 76174ff commit 9da4571
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,18 @@ public void send(final Event<?> event, boolean asynchronously) {
continue;
}

RestrictTo restrictTo = eventMethod.getParameters()[0].getAnnotation(RestrictTo.class);
if (restrictTo != null) {
EventTypes<?> interested = EventTypes.create(restrictTo.value());
if (!event.is(interested)) {
RestrictTo[] restrictTo = eventMethod.getParameters()[0].getAnnotationsByType(RestrictTo.class);
if (restrictTo.length > 0) {
boolean isInterested = false;
for (RestrictTo restrict : restrictTo) {
EventTypes<?> interestedEvent = EventTypes.create(restrict.value());
if (event.is(interestedEvent)) {
isInterested = true;
break;
}
}

if (!isInterested) {
continue;
}
}
Expand Down

0 comments on commit 9da4571

Please sign in to comment.