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 Details

    • BUILTIN

      public static final BeanRetrieval BUILTIN
      Retrieve a built-in bean.

      Retrieve the bean from a registry defined using BeanConfigurers. If a name is provided, it is interpreted as the name passed to BeanConfigurationContext.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 jakarta.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:

      1. Retrieve a pre-configured bean (see BUILTIN)
      2. Retrieve an actual managed bean, interpreting the name (if any) as the bean name (see BEAN)
      3. Retrieve an actual managed bean, interpreting the name (if any) as the class name (see CLASS)
      4. Retrieve an instance of a class through reflection, interpreting the name (if any) as the class name (see CONSTRUCTOR)
  • Method Details

    • values

      public static BeanRetrieval[] 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

      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 name
      NullPointerException - if the argument is null