Enum BeanRetrieval
- All Implemented Interfaces:
Serializable
,Comparable<BeanRetrieval>
-
Enum Constant Summary
Enum ConstantDescriptionRetrieve a bean using any available method.Retrieve an actual managed bean.Retrieve a built-in bean.Retrieve an instance of a class.Retrieve an instance of a class through the constructor directly, ignoring any bean manager. -
Method Summary
Modifier and TypeMethodDescriptionstatic BeanRetrieval
Returns the enum constant of this type with the specified name.static BeanRetrieval[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
BUILTIN
Retrieve a built-in bean.Retrieve the bean from a registry defined using
BeanConfigurer
s. If a name is provided, it is interpreted as the name passed toBeanConfigurationContext.define(Class, String, BeanReference)
. -
BEAN
Retrieve an actual managed bean.Retrieve the bean from the bean manager (e.g. CDI, Spring, ...). If a name is provided, it is interpreted as a bean name, for example assigned through
jakarta.inject.Named
. -
CLASS
Retrieve an instance of a class.First, attempt to retrieve the bean from the bean manager, (e.g. CDI, Spring, ...). Failing that, instantiate the bean using reflection, through its public, no-arg constructor. If a name is provided, it is interpreted as a class name.
-
CONSTRUCTOR
Retrieve an instance of a class through the constructor directly, ignoring any bean manager.Instantiate the bean using reflection, through its public, no-arg constructor. If a name is provided, it is interpreted as a class name.
-
ANY
Retrieve a bean using any available method.Attempts are made in the following order:
- Retrieve a pre-configured bean (see
BUILTIN
) - Retrieve an actual managed bean, interpreting the name (if any) as the bean name (see
BEAN
) - Retrieve an actual managed bean, interpreting the name (if any) as the class name (see
CLASS
) - Retrieve an instance of a class through reflection,
interpreting the name (if any) as the class name (see
CONSTRUCTOR
)
- Retrieve a pre-configured bean (see
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-