Enum BeanRetrieval

    • Enum Constant Detail

      • 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:

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