/
BeanConfigurationContextImpl.java
33 lines (26 loc) · 1.21 KB
/
BeanConfigurationContextImpl.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
/*
* 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.impl;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.hibernate.search.engine.environment.bean.spi.BeanConfigurationContext;
import org.hibernate.search.engine.environment.bean.spi.BeanFactory;
import org.hibernate.search.util.impl.common.Contracts;
final class BeanConfigurationContextImpl implements BeanConfigurationContext {
private Map<ConfiguredBeanKey<?>, BeanFactory<?>> explicitlyConfiguredBeans = new HashMap<>();
@Override
public <T> void define(Class<T> exposedType, String name, BeanFactory<T> factory) {
Contracts.assertNotNull( exposedType, "exposedType" );
Contracts.assertNotNull( name, "name" );
Contracts.assertNotNull( factory, "factory" );
explicitlyConfiguredBeans.put( new ConfiguredBeanKey<>( exposedType, name ), factory );
}
Map<ConfiguredBeanKey<?>, BeanFactory<?>> getConfiguredBeans() {
return Collections.unmodifiableMap( explicitlyConfiguredBeans );
}
}