public interface BeanProvider
Depending on the integration, beans may be resolved using reflection (expecting a no-argument constructor), or using a more advanced dependency injection context (CDI, Spring DI).
Regardless of the implementations, this interface is used to retrieve the beans, referenced either by their name, by their type, or both.
This interface may be used by any Hibernate Search module,
but should only be implemented by the Hibernate Search engine itself;
if you are looking for implementing your own bean resolver,
you should implement BeanResolver
instead.
Modifier and Type | Method and Description |
---|---|
<T> T |
getBean(BeanReference reference,
Class<T> expectedClass)
Retrieve a bean referenced by its type, name, or both, depending on the content of the
BeanReference . |
<T> T |
getBean(Class<?> typeReference,
Class<T> expectedClass)
Retrieve a bean referenced by its type.
|
<T> T |
getBean(String nameReference,
Class<T> expectedClass)
Retrieve a bean referenced by its type.
|
<T> T getBean(Class<?> typeReference, Class<T> expectedClass)
T
- The expected return type.typeReference
- The type used as a reference to the bean to retrieve.expectedClass
- The expected class. Must be non-null. The returned bean will implement this class.SearchException
- if the reference is invalid (null) or the bean cannot be resolved.<T> T getBean(String nameReference, Class<T> expectedClass)
T
- The expected return type.nameReference
- The name used as a reference to the bean to retrieve. Must be non-null and non-empty.expectedClass
- The expected class. Must be non-null. The returned bean will implement this class.SearchException
- if the reference is invalid (null or empty) or the bean cannot be resolved.<T> T getBean(BeanReference reference, Class<T> expectedClass)
BeanReference
.T
- The expected return type.reference
- The reference to the bean to retrieve. Must be non-null.expectedClass
- The expected class. Must be non-null. The returned bean will implement this class.SearchException
- if the reference is invalid (null or empty) or the bean cannot be resolved.Copyright © 2006-2018 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.