Interface BeanProvider
- All Superinterfaces:
AutoCloseable
The interface to be implemented by components providing beans to Hibernate Search.
This interface should only be called by Hibernate Search itself;
if you are looking to retrieve beans,
you should use BeanResolver
instead.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Release any internal resource created to support provided beans.<T> BeanHolder<T>
Provide a bean referenced by its type.<T> BeanHolder<T>
forTypeAndName
(Class<T> typeReference, String nameReference) Provide a bean referenced by its type and name.
-
Method Details
-
close
void close()Release any internal resource created to support provided beans.Provided beans will not be usable after a call to this method.
This may not release all resources that were allocated for each
BeanHolder
;BeanHolder.close()
still needs to be called consistently for each created bean.- Specified by:
close
in interfaceAutoCloseable
- See Also:
-
forType
Provide a bean referenced by its type.- Type Parameters:
T
- The expected return type.- Parameters:
typeReference
- The type used as a reference to the bean to retrieve. Must be non-null.- Returns:
- A
BeanHolder
containing the resolved bean. - Throws:
BeanNotFoundException
- if the bean does not exist.SearchException
- if the reference is invalid (null) or an unexpected error occurs.
-
forTypeAndName
Provide a bean referenced by its type and name.- Type Parameters:
T
- The expected return type.- Parameters:
typeReference
- The type used as a reference to the bean to retrieve. Must be non-null.nameReference
- The name used as a reference to the bean to retrieve. Must be non-null and non-empty.- Returns:
- A
BeanHolder
containing the resolved bean. - Throws:
BeanNotFoundException
- if the bean does not exist.SearchException
- if a reference is invalid (null or empty) or an unexpected error occurs.
-