Enum BeanRetrieval
- java.lang.Object
-
- java.lang.Enum<BeanRetrieval>
-
- org.hibernate.search.engine.environment.bean.BeanRetrieval
-
- All Implemented Interfaces:
Serializable
,Comparable<BeanRetrieval>
public enum BeanRetrieval extends Enum<BeanRetrieval>
Defines where beans are retrieved from.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ANY
Retrieve a bean using any available method.BEAN
Retrieve an actual managed bean.BUILTIN
Retrieve a built-in bean.CLASS
Retrieve an instance of a class.CONSTRUCTOR
Retrieve an instance of a class through the constructor directly, ignoring any bean manager.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BeanRetrieval
valueOf(String name)
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 Detail
-
BUILTIN
public static final BeanRetrieval 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
public static final BeanRetrieval 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
javax.inject.Named
.
-
CLASS
public static final BeanRetrieval 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
public static final BeanRetrieval 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
public static final BeanRetrieval 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 Detail
-
values
public static BeanRetrieval[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (BeanRetrieval c : BeanRetrieval.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static BeanRetrieval valueOf(String name)
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
-
-