org.jboss.seam.faces.util
Class BeanManagerUtils

java.lang.Object
  extended by org.jboss.seam.faces.util.BeanManagerUtils

public class BeanManagerUtils
extends Object

A utility providing common functions to simply use of BeanManager

Author:
Constructor Summary
BeanManagerUtils()
           
 
Method Summary
static
<T> T
getContextualInstance(BeanManager manager, Class<T> type)
          Get a single CDI managed instance of a specific class.
<T> T
getContextualInstance(Class<T> type)
          Get a single CDI managed instance of a specific class.
<T> List<T>
getContextualInstances(Class<T> type)
          Get all CDI managed instances of a specific class.
 void injectNonContextualInstance(Object instance)
          Perform @Inject on an object as if it were a bean managed by CDI.
<T> boolean
isDependentScoped(Class<T> type)
          Determine if a bean is Dependent scoped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanManagerUtils

public BeanManagerUtils()
Method Detail

injectNonContextualInstance

public void injectNonContextualInstance(Object instance)
Perform @Inject on an object as if it were a bean managed by CDI.

Parameters:
instance -

isDependentScoped

public <T> boolean isDependentScoped(Class<T> type)
Determine if a bean is Dependent scoped.


getContextualInstance

public <T> T getContextualInstance(Class<T> type)
Get a single CDI managed instance of a specific class. Return only the first result if multiple beans are available.

Parameters:
type - The class for which to return an instance.
Returns:
The managed instance, or null if none could be provided.

getContextualInstance

public static <T> T getContextualInstance(BeanManager manager,
                                          Class<T> type)
Get a single CDI managed instance of a specific class. Return only the first result if multiple beans are available.

NOTE: Using this method should be avoided at all costs.

Parameters:
manager - The bean manager with which to perform the lookup.
type - The class for which to return an instance.
Returns:
The managed instance, or null if none could be provided.

getContextualInstances

public <T> List<T> getContextualInstances(Class<T> type)
Get all CDI managed instances of a specific class. Return results in a List in no specific order.

Parameters:
type - The class for which to return instances.


Copyright © 2009-2011 Seam Framework. All Rights Reserved.