Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ObserverMethod#getDeclaringBean method. #578

Merged
merged 1 commit into from
Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ public interface ObserverMethod<T> extends Prioritized {
*/
public Class<?> getBeanClass();

/**
* <p>
* Obtains the {@linkplain Bean bean} that declares the observer method.
* For synthetic observers, the return value is undefined.
* </p>
*
* @return the declaring {@linkplain Bean bean}
*/
public Bean<?> getDeclaringBean();

/**
* Obtains the {@linkplain jakarta.enterprise.event observed event type}.
*
Expand Down
2 changes: 2 additions & 0 deletions spec/src/main/asciidoc/core/spi_full.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ The interface `jakarta.enterprise.inject.spi.ObserverMethod` defines everything
----
public interface ObserverMethod<T> extends Prioritized {
public Class<?> getBeanClass();
public Bean<?> getDeclaringBean();
public Type getObservedType();
public Set<Annotation> getObservedQualifiers();
public Reception getReception();
Expand All @@ -126,6 +127,7 @@ public interface ObserverMethod<T> extends Prioritized {
----

* `getBeanClass()` returns the class of the type that declares the observer method.
* `getDeclaringBean()` returns the `Bean` object that declares the observer method. Return value is undefined for synthetic observers.
* `getObservedType()` and `getObservedQualifiers()` return the observed event type and qualifiers.
* `getReception()` returns `IF_EXISTS` for a conditional observer and `ALWAYS` otherwise.
* `getTransactionPhase()` returns the appropriate transaction phase for a transactional observer method or `IN_PROGRESS` otherwise.
Expand Down