Skip to content

Commit edae31c

Browse files
authored
Introduce BeanContainer.getContexts() to be able to get hold of all context objects, even if inactive (#629)
1 parent b1f023b commit edae31c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

api/src/main/java/jakarta/enterprise/inject/spi/BeanContainer.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import java.lang.annotation.Annotation;
1515
import java.lang.reflect.Type;
16+
import java.util.Collection;
1617
import java.util.List;
1718
import java.util.Set;
1819

@@ -213,6 +214,15 @@ public interface BeanContainer {
213214
*/
214215
Context getContext(Class<? extends Annotation> scopeType);
215216

217+
/**
218+
* Obtains all {@linkplain Context context objects}, active and inactive, for the given
219+
* {@linkplain jakarta.enterprise.context scope}.
220+
*
221+
* @param scopeType the {@linkplain jakarta.enterprise.context scope}; must not be {@code null}
222+
* @return immutable collection of {@linkplain Context context objects}; never {@code null}, but may be empty
223+
*/
224+
Collection<Context> getContexts(Class<? extends Annotation> scopeType);
225+
216226
/**
217227
* Returns an instance of Event with specified type <code>java.lang.Object</code> and specified qualifier <code>@Default</code>
218228
* It allows typesafe synchronous or asynchronous event firing without injection of {@link Event} built-in bean requirement.

0 commit comments

Comments
 (0)