Interface BeanInfo
- All Known Subinterfaces:
InterceptorInfo
public interface BeanInfo
Beans are:
- managed beans
- beans defined by producer methods
- beans defined by producer fields
- synthetic beans
Class-based and producer-based beans directly correspond to a declaration in program source code. Synthetic beans don't and are instead defined through other mechanisms, such as extensions.
- Since:
- 4.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault InterceptorInfo
Returns this bean as an interceptor.Returns the class that declares this bean.disposer()
Returns the disposer method of this producer-based bean.Returns a collection of this bean's injection points.boolean
Returns whether this bean is an alternative.boolean
Returns whether this bean is a managed bean, also known as class-based bean.default boolean
Returns whether this bean is an interceptor.boolean
Returns whether this bean is defined by a producer field.boolean
Returns whether this bean is defined by a producer method.boolean
Returns whether this bean is synthetic.name()
Returns the bean name of this bean.priority()
Returns the priority declared on this bean, ornull
if this bean does not declare a priority.Returns the producer field that defines this bean.Returns the producer method that defines this bean.Returns a collection of this bean's qualifiers, represented asAnnotationInfo
.scope()
Returns the scope of this bean.Returns a collection of this bean's stereotypes.types()
Returns a collection of all types of this bean.
-
Method Details
-
scope
ScopeInfo scope()Returns the scope of this bean.- Returns:
- the scope of this bean, never
null
-
types
Collection<Type> types()Returns a collection of all types of this bean.- Returns:
- immutable collection of bean types, never
null
-
qualifiers
Collection<AnnotationInfo> qualifiers()Returns a collection of this bean's qualifiers, represented asAnnotationInfo
.- Returns:
- immutable collection of qualifiers, never
null
-
declaringClass
ClassInfo declaringClass()Returns the class that declares this bean. In case of a managed bean, also known as class-based bean, that is the bean class directly. In case of a producer method or field, that is the class that declares the producer method or field. Returnsnull
if this bean is synthetic.- Returns:
ClassInfo
for the class that declares this bean, ornull
if this bean is synthetic
-
isClassBean
boolean isClassBean()Returns whether this bean is a managed bean, also known as class-based bean.- Returns:
- whether this bean is a managed bean
-
isProducerMethod
boolean isProducerMethod()Returns whether this bean is defined by a producer method.- Returns:
- whether this bean is defined by a producer method
-
isProducerField
boolean isProducerField()Returns whether this bean is defined by a producer field.- Returns:
- whether this bean is defined by a producer field
-
isSynthetic
boolean isSynthetic()Returns whether this bean is synthetic. In other words, whether this bean does not correspond to a declaration in program source code and was created through other means (e.g. using an extension).- Returns:
- whether this bean is synthetic
-
producerMethod
MethodInfo producerMethod()Returns the producer method that defines this bean. Returnsnull
if this bean is not defined by a producer method.- Returns:
- producer method that defines this bean, or
null
if this bean is not defined by a producer method
-
producerField
FieldInfo producerField()Returns the producer field that defines this bean. Returnsnull
if this bean is not defined by a producer field.- Returns:
- producer field that defines this bean, or
null
if this bean is not defined by a producer field
-
isAlternative
boolean isAlternative()Returns whether this bean is an alternative.- Returns:
- whether this bean is an alternative
-
priority
Integer priority()Returns the priority declared on this bean, ornull
if this bean does not declare a priority. Declaring a priority on an alternative bean makes it an enabled alternative. Similarly, declaring a priority on an interceptor makes it an enabled interceptor.- Returns:
- the priority of this bean, or
null
if this bean does not declare a priority
-
name
String name()Returns the bean name of this bean. A bean name is usually defined using the@Named
annotation. Returnsnull
if the bean does not have a name.- Returns:
- the bean name, or
null
if the bean does not have a name
-
disposer
DisposerInfo disposer()Returns the disposer method of this producer-based bean. Returnsnull
if this bean is not a defined by a producer method or a producer field, or if this producer-based bean does not have a corresponding disposer method.- Returns:
- the disposer, or
null
if this bean does not have a disposer
-
stereotypes
Collection<StereotypeInfo> stereotypes()Returns a collection of this bean's stereotypes.- Returns:
- immutable collection of stereotypes, never
null
-
injectionPoints
Collection<InjectionPointInfo> injectionPoints()Returns a collection of this bean's injection points.- Returns:
- immutable collection of injection points, never
null
-
isInterceptor
default boolean isInterceptor()Returns whether this bean is an interceptor.- Returns:
- whether this bean is an interceptor
-
asInterceptor
Returns this bean as an interceptor.- Returns:
- this interceptor, never
null
- Throws:
IllegalStateException
- ifisInterceptor()
returnsfalse
-