Skip to content

Commit

Permalink
Tweaks to Bean and Event Assignability API
Browse files Browse the repository at this point in the history
* use code tags for true and false
* consistently use @ with annotation classes
* fix wrong method name in spec
* add anchor name to spec
* no implied Default qualifier for events
* Change "beans and observers" to "beans and events" in spec for
  consistency
  • Loading branch information
Azquelt authored and manovotn committed Jan 13, 2024
1 parent 8a26390 commit d2ae8ff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
22 changes: 11 additions & 11 deletions api/src/main/java/jakarta/enterprise/inject/spi/BeanContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,10 @@ public interface BeanContainer {
Instance<Object> createInstance();

/**
* Returns true if a bean with given bean types and qualifiers would be assignable
* to an injection point with given required type and required qualifiers, false otherwise.
* Returns {@code true} if a bean with given bean types and qualifiers would be assignable
* to an injection point with given required type and required qualifiers, {@code false} otherwise.
* <p>
* Callers do not need to include implied qualifiers ({@code @Default}, {@code Any}).
* Callers do not need to include implied qualifiers ({@code @Default}, {@code @Any}).
* These will be automatically added where applicable.
* <p>
* Throws {@link IllegalArgumentException} if any of the arguments is {@code null}.
Expand All @@ -267,27 +267,27 @@ public interface BeanContainer {
* @param beanQualifiers qualifiers of a bean; must not be {@code null}
* @param requiredType required type of an injection point; must not be {@code null}
* @param requiredQualifiers required qualifiers of an injection point; must not be {@code null}
* @return true if a bean with given bean types and qualifiers would be assignable
* to an injection point with given required type and required qualifiers, false otherwise
* @return {@code true} if a bean with given bean types and qualifiers would be assignable
* to an injection point with given required type and required qualifiers, {@code false} otherwise
*/
boolean isMatchingBean(Set<Type> beanTypes, Set<Annotation> beanQualifiers, Type requiredType,
Set<Annotation> requiredQualifiers);

/**
* Returns true if an event object with given type and qualifiers would match
* an observer method with given observed event type and observed event qualifiers, false otherwise.
* Returns {@code true} if an event object with given type and qualifiers would match
* an observer method with given observed event type and observed event qualifiers, {@code false} otherwise.
* <p>
* Callers do not need to include implied qualifiers ({@code @Default}, {@code Any}).
* These will be automatically added where applicable.
* Callers do not need to include the implied qualifier ({@code @Any}).
* It will be automatically added where applicable.
* <p>
* Throws {@link IllegalArgumentException} if any of the arguments is {@code null}.
*
* @param eventType type of an event object; must not be {@code null}
* @param eventQualifiers event qualifiers; must not be {@code null}
* @param observedEventType observed event type of an observer method; must not be {@code null}
* @param observedEventQualifiers observed event qualifiers on an observer method; must not be {@code null}
* @return true if an event object with given type and qualifiers would result in notifying
* an observer method with given observed event type and observed event qualifiers, false otherwise
* @return {@code true} if an event object with given type and qualifiers would result in notifying
* an observer method with given observed event type and observed event qualifiers, {@code false} otherwise
*/
boolean isMatchingEvent(Type eventType, Set<Annotation> eventQualifiers, Type observedEventType,
Set<Annotation> observedEventQualifiers);
Expand Down
6 changes: 4 additions & 2 deletions spec/src/main/asciidoc/core/beanmanager_lite.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,11 @@ Instances of dependent scoped beans obtained with this `Instance` object must be

If no qualifier is passed to `Instance.select()` method, the `@Default` qualifier is assumed.

==== Assignability of beans and observers
[[bm_bean_event_assignability]]

The methods `BeanContainer.isMatchingBean()` and `isMatchingObserver()` provide access to assignability rules defined in <<typesafe_resolution>> and <<observer_resolution>>.
==== Assignability of beans and events

The methods `BeanContainer.isMatchingBean()` and `isMatchingEvent()` provide access to assignability rules defined in <<typesafe_resolution>> and <<observer_resolution>>.

[source, java]
----
Expand Down

0 comments on commit d2ae8ff

Please sign in to comment.