public enum BeanManager extends Enum<BeanManager>
This configuration enum allows you to get a reference to CDI managed beans without having any direct CDI dependency.
It will during initialization grab the CDI bean manager instance from JNDI and if it's not
it's using reflection to get and store the necessary methods in the enum instance which are then invoked on instance
methods such as
// Get the CDI managed bean instance of the given bean class. SomeBean someBean = BeanManager.INSTANCE.getReference(SomeBean.class);
If you however already have a CDI bean manager instance at hands via
BeansLocal.getReference(javax.enterprise.inject.spi.BeanManager, Class) instead.
|Enum Constant and Description|
Returns the lazily loaded enum singleton instance.
|Modifier and Type||Method and Description|
Returns the CDI bean manager.
Returns the CDI managed bean reference (proxy) of the given class.
Returns the enum constant of this type with the specified name.
Returns an array containing the constants of this enum type, in the order they are declared.
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
public static BeanManager values()
for (BeanManager c : BeanManager.values()) System.out.println(c);
public static BeanManager valueOf(String name)
public <T> T get()
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.
nullif there is none.
UnsupportedOperationException- When obtaining the CDI managed bean reference failed with an exception.
Copyright © 2012–2014 OmniFaces. All rights reserved.