Package org.omnifaces.cdi.eager
Class EagerBeansRepository
- java.lang.Object
-
- org.omnifaces.cdi.eager.EagerBeansRepository
-
@ApplicationScoped public class EagerBeansRepository extends Object
Bean repository via which various types of eager beans can be instantiated on demand.- Since:
- 1.8
- Author:
- Arjan Tijms
-
-
Constructor Summary
Constructors Constructor Description EagerBeansRepository()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EagerBeansRepository
getInstance()
Awkward workaround for it being unavailable viaInject
in listeners in Tomcat+OWB and Jetty.protected boolean
hasAnyApplicationScopedBeans()
Returnstrue
if there are any application scoped eager beans.protected boolean
hasAnySessionOrRequestURIBeans()
Returnstrue
if there are any session scoped eager beans or eager beans by request URI.protected boolean
hasAnyViewIdBeans()
Returnstrue
if there are any eager beans by view ID.boolean
instantiateApplicationScoped()
Instantiate application scoped eager beans.static void
instantiateApplicationScopedAndRegisterListenerIfNecessary(ServletContext servletContext)
Instantiate application scoped eager beans and registerEagerBeansWebListener
if necessary.boolean
instantiateByRequestURI(String relativeRequestURI)
Instantiate eager beans by request URI.boolean
instantiateByViewID(String viewId)
Instantiate eager beans by view ID.boolean
instantiateSessionScoped()
Instantiate session scoped eager beans.protected void
setEagerBeans(org.omnifaces.cdi.eager.EagerBeansRepository.EagerBeans eagerBeans)
Sets the collected eager beans.
-
-
-
Method Detail
-
getInstance
public static EagerBeansRepository getInstance()
Awkward workaround for it being unavailable viaInject
in listeners in Tomcat+OWB and Jetty.- Returns:
- Current instance of
EagerBeansRepository
.
-
setEagerBeans
protected void setEagerBeans(org.omnifaces.cdi.eager.EagerBeansRepository.EagerBeans eagerBeans)
Sets the collected eager beans. This is invoked byEagerExtension.load(jakarta.enterprise.inject.spi.AfterDeploymentValidation, BeanManager)
.- Parameters:
eagerBeans
- The collected eager beans.
-
instantiateApplicationScopedAndRegisterListenerIfNecessary
public static void instantiateApplicationScopedAndRegisterListenerIfNecessary(ServletContext servletContext)
Instantiate application scoped eager beans and registerEagerBeansWebListener
if necessary.- Parameters:
servletContext
- The involved servlet context.
-
hasAnyApplicationScopedBeans
protected boolean hasAnyApplicationScopedBeans()
Returnstrue
if there are any application scoped eager beans.- Returns:
true
if there are any application scoped eager beans.
-
hasAnySessionOrRequestURIBeans
protected boolean hasAnySessionOrRequestURIBeans()
Returnstrue
if there are any session scoped eager beans or eager beans by request URI.- Returns:
true
if there are any session scoped eager beans or eager beans by request URI.
-
hasAnyViewIdBeans
protected boolean hasAnyViewIdBeans()
Returnstrue
if there are any eager beans by view ID.- Returns:
true
if there are any eager beans by view ID.
-
instantiateApplicationScoped
public boolean instantiateApplicationScoped()
Instantiate application scoped eager beans.- Returns:
true
if there were any application scoped eager beans.
-
instantiateSessionScoped
public boolean instantiateSessionScoped()
Instantiate session scoped eager beans.- Returns:
true
if there were any session scoped eager beans.
-
instantiateByRequestURI
public boolean instantiateByRequestURI(String relativeRequestURI)
Instantiate eager beans by request URI.- Parameters:
relativeRequestURI
- The context-relative request URI;- Returns:
true
if there were any eager beans by request URI.
-
instantiateByViewID
public boolean instantiateByViewID(String viewId)
Instantiate eager beans by view ID.- Parameters:
viewId
- The view ID;- Returns:
true
if there were any eager beans by view URI.
-
-