Class BeanResolverImpl

java.lang.Object
org.hibernate.search.engine.environment.bean.impl.BeanResolverImpl
All Implemented Interfaces:
BeanResolver

public final class BeanResolverImpl extends Object implements BeanResolver
  • Method Details

    • create

      public static BeanResolverImpl create(ClassResolver classResolver, ServiceResolver serviceResolver, BeanProvider beanManagerBeanProvider, ConfigurationPropertySource rawConfigurationPropertySource)
    • resolve

      public <T> BeanHolder<T> resolve(Class<T> typeReference, BeanRetrieval retrieval)
      Description copied from interface: BeanResolver
      Resolve a bean by its type.
      Specified by:
      resolve in interface BeanResolver
      Type Parameters:
      T - The expected return type.
      Parameters:
      typeReference - The type used as a reference to the bean to resolve. Must be non-null.
      retrieval - How to retrieve the bean. See BeanRetrieval.
      Returns:
      A BeanHolder containing the resolved bean.
    • resolve

      public <T> BeanHolder<T> resolve(Class<T> typeReference, String nameReference, BeanRetrieval retrieval)
      Description copied from interface: BeanResolver
      Resolve a bean by its name.
      Specified by:
      resolve in interface BeanResolver
      Type Parameters:
      T - The expected return type.
      Parameters:
      typeReference - The type used as a reference to the bean to resolve. Must be non-null.
      nameReference - The name used as a reference to the bean to resolve. Must be non-null and non-empty.
      retrieval - How to retrieve the bean. See BeanRetrieval.
      Returns:
      A BeanHolder containing the resolved bean.
    • allConfiguredForRole

      public <T> List<BeanReference<T>> allConfiguredForRole(Class<T> role)
      Description copied from interface: BeanResolver
      Return all the bean references configured for the given role.

      WARNING: this does not just return references to all the beans that implement role. Only beans registered during bean configuration are taken into account.

      Specified by:
      allConfiguredForRole in interface BeanResolver
      Type Parameters:
      T - The expected bean type.
      Parameters:
      role - The role that must have been assigned to the retrieved beans. Must be non-null and non-empty.
      Returns:
      A List of bean references, possibly empty.
    • namedConfiguredForRole

      public <T> Map<String,BeanReference<T>> namedConfiguredForRole(Class<T> role)
      Description copied from interface: BeanResolver
      Return named bean references configured for the given role.

      WARNING: this does not just return references to all the beans that implement role. Only beans registered during bean configuration are taken into account.

      Specified by:
      namedConfiguredForRole in interface BeanResolver
      Type Parameters:
      T - The expected bean type.
      Parameters:
      role - The role that must have been assigned to the retrieved beans. Must be non-null and non-empty.
      Returns:
      A Map from name to bean reference, possibly empty.
    • toClass

      public <T> Class<? extends T> toClass(Class<T> typeReference, String nameReference)
    • retrieveUsingConstructor

      public <T> BeanHolder<T> retrieveUsingConstructor(Class<T> typeReference)