From edae31c4629c77a44ef6814d3da57fa0886dbec0 Mon Sep 17 00:00:00 2001 From: Matej Novotny Date: Tue, 23 May 2023 16:37:02 +0200 Subject: [PATCH] Introduce BeanContainer.getContexts() to be able to get hold of all context objects, even if inactive (#629) --- .../jakarta/enterprise/inject/spi/BeanContainer.java | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 eb620edb..1d608b48 100644 --- a/api/src/main/java/jakarta/enterprise/inject/spi/BeanContainer.java +++ b/api/src/main/java/jakarta/enterprise/inject/spi/BeanContainer.java @@ -13,6 +13,7 @@ import java.lang.annotation.Annotation; import java.lang.reflect.Type; +import java.util.Collection; import java.util.List; import java.util.Set; @@ -213,6 +214,15 @@ public interface BeanContainer { */ Context getContext(Class scopeType); + /** + * Obtains all {@linkplain Context context objects}, active and inactive, for the given + * {@linkplain jakarta.enterprise.context scope}. + * + * @param scopeType the {@linkplain jakarta.enterprise.context scope}; must not be {@code null} + * @return immutable collection of {@linkplain Context context objects}; never {@code null}, but may be empty + */ + Collection getContexts(Class scopeType); + /** * Returns an instance of Event with specified type java.lang.Object and specified qualifier @Default * It allows typesafe synchronous or asynchronous event firing without injection of {@link Event} built-in bean requirement.