Enum Class BeanRetrieval
- All Implemented Interfaces:
Serializable
,Comparable<BeanRetrieval>
,Constable
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum 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 class with the specified name.static BeanRetrieval[]
values()
Returns an array containing the constants of this enum class, 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 class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException
- if the argument is null
-