Skip to content

Commit

Permalink
rename event annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
SentryMan committed Jan 28, 2024
1 parent bb41c01 commit 5c9eaca
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
@GeneratePrism(value = RequiresBean.Container.class, name = "RequiresBeanContainerPrism")
@GeneratePrism(value = RequiresProperty.Container.class, name = "RequiresPropertyContainerPrism")
@GeneratePrism(Profile.class)
@GeneratePrism(EventType.class)
@GeneratePrism(ApplicationEvent.class)
package io.avaje.inject.generator;

import io.avaje.inject.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.avaje.inject.generator.models.valid.observes;

import io.avaje.inject.event.EventType;
import io.avaje.inject.event.ApplicationEvent;

@EventType
@ApplicationEvent
public class CustomEvent {

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.example.observes;

import io.avaje.inject.event.EventType;
import io.avaje.inject.event.ApplicationEvent;

@EventType
@ApplicationEvent
public class CustomEvent {
private final String string;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

// TODO better name???
/**
* Marks a class/record as an event class, signaling the annotation processor to generate a
* publisher class for the annotated type.
*/
@Target(TYPE)
@Retention(SOURCE)
public @interface EventType {}
public @interface ApplicationEvent {}
10 changes: 3 additions & 7 deletions inject/src/main/java/io/avaje/inject/event/Event.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package io.avaje.inject.event;

import static java.util.stream.Collectors.toList;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
Expand Down Expand Up @@ -54,8 +51,7 @@ public void fire(T event, String qualifier) {
}

/**
* Fires an event asynchronously with the specified qualifier and notifies observers
* asynchronously.
* Fires an event with the specified qualifier and notifies asynchronous observers
*
* @param event the event object
* @param qualifier the qualifier for this event
Expand Down Expand Up @@ -87,7 +83,7 @@ public CompletionStage<T> fireAsync(T event, String qualifier) {
}

/**
* Fires an event and notifies sync observers with no qualifier.
* Fires an event and notifies observers with no qualifier.
*
* @param qualifier qualifier for this event
* @param event the event object
Expand All @@ -97,7 +93,7 @@ public void fire(T event) {
}

/**
* Fires an event asynchronously with the notifies async observers without qualifiers
* Fires an event to asynchronous observers without qualifiers
*
* @param event the event object
* @param qualifier the qualifier for this event
Expand Down
4 changes: 2 additions & 2 deletions inject/src/main/java/io/avaje/inject/event/ObservesAsync.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.lang.annotation.Target;

/**
* Identifies the event parameter of an observer method. May be applied to a parameter of a method
* Identifies the event parameter of an asynchronous observer method. May be applied to a parameter of a method
* of a bean class.
*
* <pre>
Expand All @@ -31,7 +31,7 @@
* has occurred.
*
* <pre>
* public void afterLogin(&#064;Observes LoggedInEvent event, &#064;Manager User user, Logger log) { ... }
* public void afterLogin(&#064;ObservesAsync LoggedInEvent event, &#064;Manager User user, Logger log) { ... }
* </pre>
*/
@Target(PARAMETER)
Expand Down

0 comments on commit 5c9eaca

Please sign in to comment.