From d2ae8ffb209177aee060d00ab00074366d54eb8f Mon Sep 17 00:00:00 2001 From: Andrew Rouse Date: Fri, 12 Jan 2024 17:12:43 +0000 Subject: [PATCH] Tweaks to Bean and Event Assignability API * 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 --- .../enterprise/inject/spi/BeanContainer.java | 22 +++++++++---------- .../asciidoc/core/beanmanager_lite.asciidoc | 6 +++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/api/src/main/java/jakarta/enterprise/inject/spi/BeanContainer.java b/api/src/main/java/jakarta/enterprise/inject/spi/BeanContainer.java index d3457279..7880387b 100644 --- a/api/src/main/java/jakarta/enterprise/inject/spi/BeanContainer.java +++ b/api/src/main/java/jakarta/enterprise/inject/spi/BeanContainer.java @@ -255,10 +255,10 @@ public interface BeanContainer { Instance 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. *

- * 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. *

* Throws {@link IllegalArgumentException} if any of the arguments is {@code null}. @@ -267,18 +267,18 @@ 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 beanTypes, Set beanQualifiers, Type requiredType, Set 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. *

- * 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. *

* Throws {@link IllegalArgumentException} if any of the arguments is {@code null}. * @@ -286,8 +286,8 @@ boolean isMatchingBean(Set beanTypes, Set beanQualifiers, Type * @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 eventQualifiers, Type observedEventType, Set observedEventQualifiers); diff --git a/spec/src/main/asciidoc/core/beanmanager_lite.asciidoc b/spec/src/main/asciidoc/core/beanmanager_lite.asciidoc index 11fdd82c..85ef3f98 100644 --- a/spec/src/main/asciidoc/core/beanmanager_lite.asciidoc +++ b/spec/src/main/asciidoc/core/beanmanager_lite.asciidoc @@ -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 <> and <>. +==== Assignability of beans and events + +The methods `BeanContainer.isMatchingBean()` and `isMatchingEvent()` provide access to assignability rules defined in <> and <>. [source, java] ----