Package org.omnifaces.util
Class BeansLocal
- java.lang.Object
-
- org.omnifaces.util.BeansLocal
-
@Typed public final class BeansLocal extends Object
Collection of utility methods for the CDI API that are mainly shortcuts for obtaining stuff from the
BeanManager
.The difference with
Beans
is that no one method ofBeansLocal
obtains theBeanManager
from JNDI. This job is up to the caller. This is more efficient in situations where multiple utility methods needs to be called at the same time.- Since:
- 2.0
- Author:
- Bauke Scholtz
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> void
destroy(BeanManager beanManager, Bean<T> bean)
static <T> void
destroy(BeanManager beanManager, Class<T> beanClass, Annotation... qualifiers)
static <T> void
destroy(BeanManager beanManager, T instance)
static void
fireEvent(BeanManager beanManager, Object event, Annotation... qualifiers)
static <S extends Annotation>
Map<Object,String>getActiveInstances(BeanManager beanManager, Class<S> scope)
static <A extends Annotation>
AgetAnnotation(BeanManager beanManager, Annotated annotated, Class<A> annotationType)
static InjectionPoint
getCurrentInjectionPoint(BeanManager beanManager, CreationalContext<?> creationalContext)
static <T> T
getInstance(BeanManager beanManager, Bean<T> bean, boolean create)
static <T> T
getInstance(BeanManager beanManager, Class<T> beanClass, boolean create, Annotation... qualifiers)
static <T> T
getInstance(BeanManager beanManager, Class<T> beanClass, Annotation... qualifiers)
static <T> T
getInstance(BeanManager beanManager, String name)
static <T> T
getInstance(BeanManager beanManager, String name, boolean create)
static <T> T
getReference(BeanManager beanManager, Bean<T> bean)
static <T> T
getReference(BeanManager beanManager, Class<T> beanClass, Annotation... qualifiers)
static <S extends Annotation>
booleanisActive(BeanManager beanManager, Class<S> scope)
static <T> Bean<T>
resolve(BeanManager beanManager, Class<T> beanClass, Annotation... qualifiers)
static <T> Bean<T>
resolveExact(BeanManager beanManager, Class<T> beanClass, Annotation... qualifiers)
static <T> T
unwrapIfNecessary(BeanManager beanManager, T object)
-
-
-
Method Detail
-
resolve
public static <T> Bean<T> resolve(BeanManager beanManager, Class<T> beanClass, Annotation... qualifiers)
- See Also:
Beans.resolve(Class, Annotation...)
-
resolveExact
public static <T> Bean<T> resolveExact(BeanManager beanManager, Class<T> beanClass, Annotation... qualifiers)
- See Also:
Beans.resolveExact(Class, Annotation...)
-
getReference
public static <T> T getReference(BeanManager beanManager, Class<T> beanClass, Annotation... qualifiers)
- See Also:
Beans.getReference(Class, Annotation...)
-
getReference
public static <T> T getReference(BeanManager beanManager, Bean<T> bean)
- See Also:
Beans.getReference(Bean)
-
getInstance
public static <T> T getInstance(BeanManager beanManager, Class<T> beanClass, Annotation... qualifiers)
- See Also:
Beans.getInstance(Class, Annotation...)
-
getInstance
public static <T> T getInstance(BeanManager beanManager, Class<T> beanClass, boolean create, Annotation... qualifiers)
-
getInstance
public static <T> T getInstance(BeanManager beanManager, Bean<T> bean, boolean create)
- See Also:
Beans.getInstance(Bean, boolean)
-
getInstance
public static <T> T getInstance(BeanManager beanManager, String name, boolean create)
- See Also:
Beans.getInstance(String, boolean)
-
getInstance
public static <T> T getInstance(BeanManager beanManager, String name)
- See Also:
Beans.getInstance(String)
-
unwrapIfNecessary
public static <T> T unwrapIfNecessary(BeanManager beanManager, T object)
- See Also:
Beans.unwrapIfNecessary(Object)
-
isActive
public static <S extends Annotation> boolean isActive(BeanManager beanManager, Class<S> scope)
- See Also:
Beans.isActive(Class)
-
getActiveInstances
public static <S extends Annotation> Map<Object,String> getActiveInstances(BeanManager beanManager, Class<S> scope)
- See Also:
Beans.getActiveInstances(Class)
-
destroy
public static <T> void destroy(BeanManager beanManager, Class<T> beanClass, Annotation... qualifiers)
- See Also:
Beans.destroy(Class, Annotation...)
-
destroy
public static <T> void destroy(BeanManager beanManager, Bean<T> bean)
- See Also:
Beans.destroy(Bean)
-
destroy
public static <T> void destroy(BeanManager beanManager, T instance)
- See Also:
Beans.destroy(Object)
-
getAnnotation
public static <A extends Annotation> A getAnnotation(BeanManager beanManager, Annotated annotated, Class<A> annotationType)
- See Also:
Beans.getAnnotation(Annotated, Class)
-
getCurrentInjectionPoint
public static InjectionPoint getCurrentInjectionPoint(BeanManager beanManager, CreationalContext<?> creationalContext)
- See Also:
Beans.getAnnotation(Annotated, Class)
-
fireEvent
public static void fireEvent(BeanManager beanManager, Object event, Annotation... qualifiers)
- See Also:
Beans.fireEvent(Object, Annotation...)
-
-