|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface BeanManager
Allows a portable extension to interact directly with the container. Provides operations for obtaining contextual references for beans, along with many other operations of use to portable extensions.
Any bean may obtain an instance of BeanManager by injecting it:
@Inject BeanManager manager;
Java EE components may obtain an instance of BeanManager from
JNDI by looking up the name java:comp/BeanManager
.
Any operation of BeanManager may be called at any time during the execution of the application.
Method Summary | ||
---|---|---|
|
createAnnotatedType(java.lang.Class<T> type)
Get an AnnotatedType for the given class |
|
|
createCreationalContext(Contextual<T> contextual)
Obtain an instance of a CreationalContext for the given contextual |
|
|
createInjectionTarget(AnnotatedType<T> type)
Returns an InjectionTarget to allow injection into custom beans or non-contextual instances by portable extensions. |
|
void |
fireEvent(java.lang.Object event,
java.lang.annotation.Annotation... qualifiers)
Fires an event and notifies observers. |
|
java.util.Set<Bean<?>> |
getBeans(java.lang.String name)
Returns the set of beans which have the given EL name and are available for injection in the module or library containing the class into which the BeanManager was injected or the Java EE component from whose JNDI environment namespace the BeanManager was obtained, according to the rules of EL name resolution. |
|
java.util.Set<Bean<?>> |
getBeans(java.lang.reflect.Type beanType,
java.lang.annotation.Annotation... qualifiers)
Returns the set of beans which have the given required type and qualifiers and are available for injection in the module or library containing the class into which the BeanManager was injected or the Java EE component from whose JNDI environment namespace the BeanManager was obtained, according to the rules of typesafe resolution. |
|
Context |
getContext(java.lang.Class<? extends java.lang.annotation.Annotation> scopeType)
Obtains an active context instance for the given scope type. |
|
javax.el.ELResolver |
getELResolver()
Returns the ELResolver for integration with the servlet
engine and JSF implementation. |
|
java.lang.Object |
getInjectableReference(InjectionPoint ij,
CreationalContext<?> ctx)
Obtains an instance of bean for a given injection point. |
|
java.util.Set<java.lang.annotation.Annotation> |
getInterceptorBindingTypeDefinition(java.lang.Class<? extends java.lang.annotation.Annotation> bindingType)
Obtains the set of meta-annotations for an interceptor binding type. |
|
|
getMostSpecializedBean(Bean<X> bean)
Returns the Bean object representing the
most specialized enabled bean registered with the container that
specializes the given bean, |
|
Bean<?> |
getPassivationCapableBean(java.lang.String id)
Returns the PassivationCapableBean with the given identifier. |
|
java.lang.Object |
getReference(Bean<?> bean,
java.lang.reflect.Type beanType,
CreationalContext<?> ctx)
Obtains a contextual reference for a given bean and a given bean type. |
|
java.util.Set<java.lang.annotation.Annotation> |
getStereotypeDefinition(java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
Obtains meta-annotations for a stereotype. |
|
boolean |
isInterceptorBindingType(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Tests the given annotationType to determine if it is an interceptor binding type. |
|
boolean |
isNormalScope(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Tests the given annotationType to determine if it is a normal scope type. |
|
boolean |
isPassivatingScope(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Tests the given annotationType to determine if it is a passivating scope type. |
|
boolean |
isQualifier(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Tests the given annotationType to determine if it is a qualifier type. |
|
boolean |
isScope(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Tests the given annotationType to determine if it is a scope type. |
|
boolean |
isStereotype(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Tests the given annotationType to determine if it is a stereotype. |
|
|
resolve(java.util.Set<Bean<? extends X>> beans)
Apply the ambiguous dependency resolution rules |
|
java.util.List<Decorator<?>> |
resolveDecorators(java.util.Set<java.lang.reflect.Type> types,
java.lang.annotation.Annotation... qualifiers)
Obtains an ordered list of enabled decorators for a set of bean types and a set of qualifiers. |
|
java.util.List<Interceptor<?>> |
resolveInterceptors(InterceptionType type,
java.lang.annotation.Annotation... interceptorBindings)
Obtains an ordered list of enabled interceptors for a set of interceptor bindings. |
|
|
resolveObserverMethods(T event,
java.lang.annotation.Annotation... qualifiers)
Obtains observers for an event by considering event type and qualifiers. |
|
void |
validate(InjectionPoint injectionPoint)
Validates the injection point dependency. |
|
javax.el.ExpressionFactory |
wrapExpressionFactory(javax.el.ExpressionFactory expressionFactory)
Returns a wrapper ExpressionFactory that delegates
MethodExpression and ValueExpression
creation to the given ExpressionFactory . |
Method Detail |
---|
java.lang.Object getReference(Bean<?> bean, java.lang.reflect.Type beanType, CreationalContext<?> ctx)
bean
- the Bean
object representing the beanbeanType
- a bean type that must be implemented by any proxy that is
returned
java.lang.IllegalArgumentException
- if the given type is not a bean type of
the given beanjava.lang.Object getInjectableReference(InjectionPoint ij, CreationalContext<?> ctx)
ij
- the injection point the instance is needed forctx
- the context in which the injection is occurring
UnsatisfiedResolutionException
- if no bean can be resolved for the
given type and bindings
AmbiguousResolutionException
- if more than one bean is resolved for
the given type and bindings<T> CreationalContext<T> createCreationalContext(Contextual<T> contextual)
CreationalContext
for the given contextual
contextual
- the contextual to create a creational context for
CreationalContext
instancejava.util.Set<Bean<?>> getBeans(java.lang.reflect.Type beanType, java.lang.annotation.Annotation... qualifiers)
beanType
- the type of the beans to be resolvedqualifiers
- the qualifiers used to restrict the matched beans. If no
qualifiers are passed to getBeans(), the default binding @Current
is assumed.
java.lang.IllegalArgumentException
- if the given type represents a type
variable
java.lang.IllegalArgumentException
- if two instances of the same binding type
are
java.lang.IllegalArgumentException
- if an instance of an annotation that is
not a binding type is givenjava.util.Set<Bean<?>> getBeans(java.lang.String name)
name
- the name used to restrict the beans matched
<X> Bean<? extends X> getMostSpecializedBean(Bean<X> bean)
Bean
object representing the
most specialized enabled bean registered with the container that
specializes the given bean,
X
- the type of the beanbean
- the Bean
representation of the
bean.
Bean<?> getPassivationCapableBean(java.lang.String id)
<X> Bean<? extends X> resolve(java.util.Set<Bean<? extends X>> beans)
X
- the type of the beanbeans
- a set of beans of the given type
AmbiguousResolutionException
- if the ambiguous dependency
resolution rules failvoid validate(InjectionPoint injectionPoint)
injectionPoint
- the injection point to validate
an
- InjectionException if there is a deployment problem (for
example, an unsatisfied or unresolvable ambiguous dependency)
associated with the injection point.void fireEvent(java.lang.Object event, java.lang.annotation.Annotation... qualifiers)
event
- the event objectqualifiers
- the event qualifiers used to restrict the observers
matched
java.lang.IllegalArgumentException
- if the runtime type of the event object
contains a type variable
java.lang.IllegalArgumentException
- if two instances of the same binding type
are given
java.lang.IllegalArgumentException
- if an instance of an annotation that is
not a binding type is given,<T> java.util.Set<ObserverMethod<?,T>> resolveObserverMethods(T event, java.lang.annotation.Annotation... qualifiers)
T
- the type of the event to obtainevent
- the event objectqualifiers
- the qualifiers used to restrict the matched observers
java.lang.IllegalArgumentException
- if a parameterized type with a type
parameter or a wildcard is passed
java.lang.IllegalArgumentException
- if an annotation which is not a event
binding type is passed
java.lang.IllegalArgumentException
- if two instances of the same binding type
are passedjava.util.List<Decorator<?>> resolveDecorators(java.util.Set<java.lang.reflect.Type> types, java.lang.annotation.Annotation... qualifiers)
types
- the set of bean types of the decorated beanqualifiers
- the qualifiers declared by the decorated bean
java.lang.IllegalArgumentException
- if the set of bean types is empty
java.lang.IllegalArgumentException
- if an annotation which is not a binding
type is passed
java.lang.IllegalArgumentException
- if two instances of the same binding type
are passedjava.util.List<Interceptor<?>> resolveInterceptors(InterceptionType type, java.lang.annotation.Annotation... interceptorBindings)
type
- the type of the interceptioninterceptorBindings
- the bindings used to restrict the matched
interceptors
java.lang.IllegalArgumentException
- if no interceptor binding type is passed
java.lang.IllegalArgumentException
- if an annotation which is not a
interceptor binding type is passed
java.lang.IllegalArgumentException
- if two instances of the same binding type
are passedboolean isScope(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
annotationType
- the annotation to test
boolean isNormalScope(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
annotationType
- the annotation to test
boolean isPassivatingScope(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
annotationType
- the annotation to test
boolean isQualifier(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
annotationType
- the annotation to test
boolean isInterceptorBindingType(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
annotationType
- the annotation to test
boolean isStereotype(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
annotationType
- the annotation to test
java.util.Set<java.lang.annotation.Annotation> getInterceptorBindingTypeDefinition(java.lang.Class<? extends java.lang.annotation.Annotation> bindingType)
bindingType
- the annotation for which to obtain meta-annotations
java.util.Set<java.lang.annotation.Annotation> getStereotypeDefinition(java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
stereotype
- the stereotype for which to obtain meta-annotations
Context getContext(java.lang.Class<? extends java.lang.annotation.Annotation> scopeType)
scopeType
- the scope to get
the context instance for
ContextNotActiveException
- if no active contexts exist for the
given scope type
java.lang.IllegalArgumentException
- if more than one active context exists
for the given scope typejavax.el.ELResolver getELResolver()
ELResolver
for integration with the servlet
engine and JSF implementation. This resolver will return a contextual
instance of a bean if the name for resolution resolves to exactly one
bean.
javax.el.ExpressionFactory wrapExpressionFactory(javax.el.ExpressionFactory expressionFactory)
ExpressionFactory
that delegates
MethodExpression
and ValueExpression
creation to the given ExpressionFactory
. When a Unified
EL expression is evaluated using a MethodExpression
or
ValueExpression
returned by the wrapper
ExpressionFactory
expressionFactory
- the expression factory to wrap
ExpressionFactory
<T> AnnotatedType<T> createAnnotatedType(java.lang.Class<T> type)
AnnotatedType
for the given class
T
- the typetype
- the type
AnnotatedType
<T> InjectionTarget<T> createInjectionTarget(AnnotatedType<T> type)
T
- the type of the AnnotatedType to inspecttype
- the AnnotatedType to inspect
java.lang.IllegalArgumentException
- if there is a definition error associated
with any injection point of the type.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |