Beans
utility class instead. This enum is a leftover from OmniFaces 1.x.@Deprecated public enum BeanManager extends Enum<BeanManager>
This configuration enum allows you to get the CDI BeanManager
anyway in cases where
@Inject
and/or CDI#current()
may not work, or when you'd like to test availability of
CDI without having any direct CDI dependency (as previously done in ApplicationListener
). It will during
initialization grab the CDI bean manager instance as generic object from JNDI.
Enum Constant and Description |
---|
INSTANCE
Deprecated.
Returns the lazily loaded enum singleton instance.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
get()
Deprecated.
Returns the CDI bean manager.
|
<T> T |
getReference(Class<T> beanClass)
Deprecated.
Returns the CDI managed bean reference (proxy) of the given class.
|
void |
init(ServletContext servletContext)
Deprecated.
Perform manual initialization whereby the bean manager is looked up from servlet context when not available.
|
static BeanManager |
valueOf(String name)
Deprecated.
Returns the enum constant of this type with the specified name.
|
static BeanManager[] |
values()
Deprecated.
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final BeanManager INSTANCE
IllegalStateException
when initialization fails.public static BeanManager[] values()
for (BeanManager c : BeanManager.values()) System.out.println(c);
public static BeanManager valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic void init(ServletContext servletContext)
servletContext
- The servlet context to obtain the BeanManager from, if necessary.IllegalStateException
- When initialization fails.public <T> T get()
Beans.getManager()
for this.T
- The javax.enterprise.inject.spi.BeanManager
.ClassCastException
- When you assign it to a variable which is not declared as CDI BeanManager.public <T> T getReference(Class<T> beanClass)
T
- The expected return type.beanClass
- The CDI managed bean class.null
if there is none.UnsupportedOperationException
- When obtaining the CDI managed bean reference failed with an exception.Copyright © 2012–2018 OmniFaces. All rights reserved.