javax.enterprise.inject.spi
Interface BeanManager

All Known Implementing Classes:
InjectManager

public interface BeanManager

API for the Java Injection (JSR-299) BeanManager. Applications needing a programmatic interface to BeanManager can use JNDI at "java:comp/BeanManager". Bean registered with CanDI can use injection to get the manager.


Method Summary
<T> AnnotatedType<T>
createAnnotatedType(java.lang.Class<T> type)
          Creates an introspected annotated type.
<T> CreationalContext<T>
createCreationalContext(Contextual<T> contextual)
          Creates a new CreationalContext for instantiating a bean.
<T> InjectionTarget<T>
createInjectionTarget(AnnotatedType<T> type)
          Creates an injection target
 void fireEvent(java.lang.Object event, java.lang.annotation.Annotation... qualifiers)
          Fires an event
 java.util.Set<Bean<?>> getBeans(java.lang.String name)
          Returns the bean definitions matching a given name
 java.util.Set<Bean<?>> getBeans(java.lang.reflect.Type beanType, java.lang.annotation.Annotation... qualiviers)
          Returns the beans matching a class and annotation set
 Context getContext(java.lang.Class<? extends java.lang.annotation.Annotation> scopeType)
          Returns the scope context for the given type
 ELResolver getELResolver()
          Returns the BeanManager's EL resolver.
 java.lang.Object getInjectableReference(InjectionPoint ij, CreationalContext<?> ctx)
          Internal callback during creation to get a new injection instance.
 java.util.Set<java.lang.annotation.Annotation> getInterceptorBindingDefinition(java.lang.Class<? extends java.lang.annotation.Annotation> bindingType)
          Returns the bindings for an interceptor binding type
 Bean<?> getPassivationCapableBean(java.lang.String id)
          Returns the passivation-capable bean with the given id.
 java.lang.Object getReference(Bean<?> bean, java.lang.reflect.Type beanType, CreationalContext<?> env)
          Returns an instance for the given bean.
 java.util.Set<java.lang.annotation.Annotation> getStereotypeDefinition(java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
          Returns the annotations associated with a stereotype
 boolean isInterceptorBinding(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Tests if an annotation is an enabled interceptor binding type
 boolean isNormalScope(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Tests if an annotation is an enabled scope type
 boolean isPassivatingScope(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Tests if an annotation is an enabled scope type
 boolean isQualifier(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Tests if an annotation is an enabled qualifier type
 boolean isScope(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Tests if an annotation is an enabled scope type
 boolean isStereotype(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
          Tests if an annotation is an enabled stereotype.
<X> Bean<? extends X>
resolve(java.util.Set<Bean<? extends X>> beans)
          Returns the bean with the highest precedence deployment type from a set.
 java.util.List<Decorator<?>> resolveDecorators(java.util.Set<java.lang.reflect.Type> types, java.lang.annotation.Annotation... qualifiers)
          Resolves the decorators for a given set of types
 java.util.List<Interceptor<?>> resolveInterceptors(InterceptionType type, java.lang.annotation.Annotation... bindings)
          Resolves the interceptors for a given interceptor type
<T> java.util.Set<ObserverMethod<? super T>>
resolveObserverMethods(T event, java.lang.annotation.Annotation... qualifiers)
          Returns the observers listening for an event
 void validate(InjectionPoint injectionPoint)
          Internal callback during creation to get a new injection instance.
 ExpressionFactory wrapExpressionFactory(ExpressionFactory expressionFactory)
          Returns the BeanManager's EL resolver.
 

Method Detail

isScope

boolean isScope(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Tests if an annotation is an enabled scope type


isPassivatingScope

boolean isPassivatingScope(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Tests if an annotation is an enabled scope type


isNormalScope

boolean isNormalScope(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Tests if an annotation is an enabled scope type


isQualifier

boolean isQualifier(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Tests if an annotation is an enabled qualifier type


isInterceptorBinding

boolean isInterceptorBinding(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Tests if an annotation is an enabled interceptor binding type


getInterceptorBindingDefinition

java.util.Set<java.lang.annotation.Annotation> getInterceptorBindingDefinition(java.lang.Class<? extends java.lang.annotation.Annotation> bindingType)
Returns the bindings for an interceptor binding type


isStereotype

boolean isStereotype(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Tests if an annotation is an enabled stereotype.


getStereotypeDefinition

java.util.Set<java.lang.annotation.Annotation> getStereotypeDefinition(java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
Returns the annotations associated with a stereotype


createAnnotatedType

<T> AnnotatedType<T> createAnnotatedType(java.lang.Class<T> type)
Creates an introspected annotated type.


createInjectionTarget

<T> InjectionTarget<T> createInjectionTarget(AnnotatedType<T> type)
Creates an injection target


getBeans

java.util.Set<Bean<?>> getBeans(java.lang.reflect.Type beanType,
                                java.lang.annotation.Annotation... qualiviers)
Returns the beans matching a class and annotation set

Parameters:
type - the bean's class
qualifiers - array of required @Qualifier annotations

getBeans

java.util.Set<Bean<?>> getBeans(java.lang.String name)
Returns the bean definitions matching a given name

Parameters:
name - the name of the bean to match

resolve

<X> Bean<? extends X> resolve(java.util.Set<Bean<? extends X>> beans)
Returns the bean with the highest precedence deployment type from a set.

Parameters:
beans - the set of beans to select from

getPassivationCapableBean

Bean<?> getPassivationCapableBean(java.lang.String id)
Returns the passivation-capable bean with the given id. Used by custom Contexts during deserialization to get the beans needed for destruction.

Parameters:
id - the basic bean

validate

void validate(InjectionPoint injectionPoint)
Internal callback during creation to get a new injection instance.


createCreationalContext

<T> CreationalContext<T> createCreationalContext(Contextual<T> contextual)
Creates a new CreationalContext for instantiating a bean. Normally used for getReference by frameworks.


getReference

java.lang.Object getReference(Bean<?> bean,
                              java.lang.reflect.Type beanType,
                              CreationalContext<?> env)
Returns an instance for the given bean. This method will obey the scope of the bean, so a singleton will return the single bean.

Parameters:
bean - the metadata for the bean
beanType - the expected type
env - the creational context environment for the bean
Returns:
an instance of the bean obeying scope

getInjectableReference

java.lang.Object getInjectableReference(InjectionPoint ij,
                                        CreationalContext<?> ctx)
Internal callback during creation to get a new injection instance.


getContext

Context getContext(java.lang.Class<? extends java.lang.annotation.Annotation> scopeType)
Returns the scope context for the given type


getELResolver

ELResolver getELResolver()
Returns the BeanManager's EL resolver.


wrapExpressionFactory

ExpressionFactory wrapExpressionFactory(ExpressionFactory expressionFactory)
Returns the BeanManager's EL resolver.


resolveObserverMethods

<T> java.util.Set<ObserverMethod<? super T>> resolveObserverMethods(T event,
                                                                    java.lang.annotation.Annotation... qualifiers)
Returns the observers listening for an event

Parameters:
eventType - event to resolve
qualifiers - the qualifier set for the event

fireEvent

void fireEvent(java.lang.Object event,
               java.lang.annotation.Annotation... qualifiers)
Fires an event

Parameters:
event - the event to fire
qualifiers - the event qualifiers

resolveInterceptors

java.util.List<Interceptor<?>> resolveInterceptors(InterceptionType type,
                                                   java.lang.annotation.Annotation... bindings)
Resolves the interceptors for a given interceptor type

Parameters:
type - the main interception type
bindings - qualifying bindings
Returns:
the matching interceptors

resolveDecorators

java.util.List<Decorator<?>> resolveDecorators(java.util.Set<java.lang.reflect.Type> types,
                                               java.lang.annotation.Annotation... qualifiers)
Resolves the decorators for a given set of types

Parameters:
types - the types to match for the decorator
qualifier - qualifiers
Returns:
the matching interceptors