-
Notifications
You must be signed in to change notification settings - Fork 242
/
BeanResolver.java
65 lines (57 loc) · 2.39 KB
/
BeanResolver.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* Hibernate Search, full-text search for your domain model
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.search.engine.environment.bean.spi;
import org.hibernate.search.engine.environment.bean.BeanProvider;
import org.hibernate.search.util.SearchException;
/**
* The interface to be implemented by components providing beans to Hibernate Search.
* <p>
* This interface should only be called by the Hibernate Search engine itself;
* if you are looking for retrieving beans from another module,
* you should use {@link BeanProvider} instead.
*/
public interface BeanResolver extends AutoCloseable {
/**
* Release any internal resource created while resolving beans.
* <p>
* Provided beans will not be usable after a call to this method.
*
* @see AutoCloseable#close()
*/
@Override
void close();
/**
* Resolve a bean by its type.
* @param <T> The expected return type.
* @param expectedClass The expected class. The returned bean must implement this class.
* @param typeReference The type of the bean to resolve.
* Depending on the implementation, this could be a superclass or superinterface of the resolved bean.
* @return The resolved bean.
* @throws SearchException if the bean cannot be resolved.
*/
<T> T resolve(Class<T> expectedClass, Class<?> typeReference);
/**
* Resolve a bean by its name.
* @param <T> The expected return type.
* @param expectedClass The expected class. The returned bean must implement this class.
* @param nameReference The name of the bean to resolve.
* @return The resolved bean.
* @throws SearchException if the bean cannot be resolved.
*/
<T> T resolve(Class<T> expectedClass, String nameReference);
/**
* Resolve a bean by its name <em>and</em> type.
* @param <T> The expected return type.
* @param expectedClass The expected class. The returned bean must implement this class.
* @param nameReference The name of the bean to resolve.
* @param typeReference The type of the bean to resolve.
* Depending on the implementation, this could be a superclass or superinterface of the resolved bean.
* @return The resolved bean.
* @throws SearchException if the bean cannot be resolved.
*/
<T> T resolve(Class<T> expectedClass, String nameReference, Class<?> typeReference);
}