Package io.quarkus.arc
Interface InjectableBean<T>
- Type Parameters:
T-
- All Superinterfaces:
jakarta.enterprise.inject.spi.Bean<T>,jakarta.enterprise.inject.spi.BeanAttributes<T>,jakarta.enterprise.context.spi.Contextual<T>,InjectableReferenceProvider<T>
- All Known Subinterfaces:
InjectableDecorator<T>,InjectableInterceptor<T>
- All Known Implementing Classes:
BeanManagerBean,BuiltInBean,EventBean,InitializedInterceptor,InjectionPointBean,InstanceBean
public interface InjectableBean<T>
extends jakarta.enterprise.inject.spi.Bean<T>, InjectableReferenceProvider<T>
Quarkus representation of an injectable bean.
This interface extends the standard CDI
Bean interface.- Author:
- Martin Kouba
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondefault ActiveResultReturns whether this bean is active and if not, the reason why.default voiddefault Integerdefault InjectableBean<?> The identifier is generated by the container and is unique for a specific deployment.default Class<?> The return value depends on thegetKind().default Set<jakarta.enterprise.inject.spi.InjectionPoint> By default, this method always returns an empty set, because obtaining the set of injection points of a bean at application runtime is rarely useful.default InjectableBean.KindgetKind()default StringgetName()default intA bean may have a priority assigned.default Set<Annotation> default Class<? extends Annotation> getScope()default Set<Class<? extends Annotation>> getTypes()default booleanReturns whether this bean has an explicitly assigned priority.default booleanisActive()Equivalent tocheckActive().value().default booleandefault booleandefault booleanSuppressed beans cannot be obtained by programmatic lookup viaInstance.Methods inherited from interface jakarta.enterprise.inject.spi.Bean
getBeanClassMethods inherited from interface jakarta.enterprise.context.spi.Contextual
createMethods inherited from interface io.quarkus.arc.InjectableReferenceProvider
get
-
Method Details
-
getIdentifier
String getIdentifier()The identifier is generated by the container and is unique for a specific deployment.- Returns:
- the identifier for this bean
-
getKind
- Returns:
- the kind of the bean
- See Also:
-
getScope
- Specified by:
getScopein interfacejakarta.enterprise.inject.spi.BeanAttributes<T>- Returns:
- the scope
-
getTypes
- Specified by:
getTypesin interfacejakarta.enterprise.inject.spi.BeanAttributes<T>- Returns:
- the set of bean types
-
getQualifiers
- Specified by:
getQualifiersin interfacejakarta.enterprise.inject.spi.BeanAttributes<T>- Returns:
- the set of qualifiers
-
destroy
default void destroy(T instance, jakarta.enterprise.context.spi.CreationalContext<T> creationalContext) - Specified by:
destroyin interfacejakarta.enterprise.context.spi.Contextual<T>
-
getDeclaringBean
- Returns:
- the declaring bean if the bean is a producer method/field, or
null
-
getName
- Specified by:
getNamein interfacejakarta.enterprise.inject.spi.BeanAttributes<T>
-
getStereotypes
- Specified by:
getStereotypesin interfacejakarta.enterprise.inject.spi.BeanAttributes<T>
-
getInjectionPoints
By default, this method always returns an empty set, because obtaining the set of injection points of a bean at application runtime is rarely useful.In the strict mode, this method works as described by the CDI specification. Feedback on usefulness of this method is welcome!
- Specified by:
getInjectionPointsin interfacejakarta.enterprise.inject.spi.Bean<T>
-
isAlternative
default boolean isAlternative()- Specified by:
isAlternativein interfacejakarta.enterprise.inject.spi.BeanAttributes<T>
-
getAlternativePriority
- Returns:
- the priority if the bean is an alternative, or
null
-
isDefaultBean
default boolean isDefaultBean()- Returns:
- whether or not the bean is a default bean
-
isSuppressed
default boolean isSuppressed()Suppressed beans cannot be obtained by programmatic lookup viaInstance.- Returns:
trueif the bean should be suppressed
-
hasPriority
default boolean hasPriority()Returns whether this bean has an explicitly assigned priority. This is typically done using the@Priorityannotation.Calling
getPriority()is not enough to determine if a bean has an explicitly assigned priority, because that method returns0when no priority was assigned. That is not distinguishable from a situation when a bean has explicitly assigned priority of0.- Returns:
- whether this bean has an explicitly assigned priority
-
getPriority
default int getPriority()A bean may have a priority assigned.Class-based beans and producer beans can specify the priority declaratively via
Priority. If no priority annotation is used then a bean has the priority of value 0.This priority is used to sort the resolved beans when performing programmatic lookup via
Instanceor when injecting a list of beans by means of theAllqualifier.- Returns:
- the priority
- See Also:
-
getImplementationClass
The return value depends on thegetKind().- For managed beans, interceptors, decorators and built-in beans, the bean class is returned.
- For a producer method, the class of the return type is returned.
- For a producer field, the class of the field is returned.
- For a synthetic bean, the implementation class defined by the registrar is returned.
- Returns:
- the implementation class, or null in case of a producer of a primitive type or an array
- See Also:
-
isActive
default boolean isActive()Equivalent tocheckActive().value().- See Also:
-
checkActive
Returns whether this bean is active and if not, the reason why. Certain synthetic beans may be inactive from time to time. Attempting to inject or lookup such an inactive bean leads toInactiveBeanException.- Returns:
- whether this bean is active and if not, the reason why
-