Skip to content

Commit

Permalink
Improve specification of BeanManager.isMatchingBean() and `isMatchi…
Browse files Browse the repository at this point in the history
…ngEvent()`
  • Loading branch information
Ladicek committed Jan 24, 2024
1 parent 45b911d commit 483608c
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions api/src/main/java/jakarta/enterprise/inject/spi/BeanContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,15 @@ public interface BeanContainer {
* <p>
* In line with the specification for beans and typesafe resolution, the set of
* {@code beanTypes} is considered to always include {@code java.lang.Object}.
* Types in {@code beanTypes} that are not legal bean types are ignored.
* The set of {@code beanQualifiers} is considered to always include {@code @Any} and
* also include {@code @Default} when it contains no other qualifier but {@code @Any}
* and {@code @Named}. The set of {@code requiredQualifiers} is considered to include
* {@code @Default} when it is empty.
* <p>
* Throws {@link IllegalArgumentException} if any of the arguments is {@code null}.
* Throws {@link IllegalArgumentException} if any of the arguments is {@code null}
* or if any of the {@code beanQualifiers} or {@code requiredQualifiers} is not
* a qualifier annotation.
*
* @param beanTypes bean types of a bean; must not be {@code null}
* @param beanQualifiers qualifiers of a bean; must not be {@code null}
Expand All @@ -278,21 +281,24 @@ boolean isMatchingBean(Set<Type> beanTypes, Set<Annotation> beanQualifiers, Type
Set<Annotation> requiredQualifiers);

/**
* Returns {@code true} if an event object with given type and qualifiers would match
* Returns {@code true} if an event object with given runtime type and qualifiers would match
* an observer method with given observed event type and observed event qualifiers, {@code false} otherwise.
* <p>
* In line with the specification for events and observer resolution, the set of
* {@code eventQualifiers} is considered to always include {@code @Any}.
* {@code eventQualifiers} is considered to always include {@code @Any} and also include
* {@code @Default} when it contains no other qualifier but {@code @Any}.
* <p>
* Throws {@link IllegalArgumentException} if any of the arguments is {@code null}.
* Throws {@link IllegalArgumentException} if any of the arguments is {@code null},
* if the {@code eventObjectType} contains an unresolved type variable, or if any of
* the {@code eventQualifiers} or {@code observedEventQualifiers} is not a qualifier annotation.
*
* @param eventType type of an event object; must not be {@code null}
* @param eventObjectType runtime 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 {@code true} if an event object with given type and qualifiers would result in notifying
* @return {@code true} if an event object with given runtime 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,
boolean isMatchingEvent(Type eventObjectType, Set<Annotation> eventQualifiers, Type observedEventType,
Set<Annotation> observedEventQualifiers);
}

0 comments on commit 483608c

Please sign in to comment.