Skip to content

Commit

Permalink
Add ObserverMethod#getDeclaringBean method.
Browse files Browse the repository at this point in the history
  • Loading branch information
manovotn committed Dec 7, 2021
1 parent 7b085ac commit 1b8c3eb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
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

0 comments on commit 1b8c3eb

Please sign in to comment.