summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/components/MemoryComponentRepository.java
blob: 658aaa1d1a75bae8c0e94b55ce8d8bf4511f1ae8 (plain)
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
package bjc.utils.components;

import bjc.utils.funcdata.IMap;

public class MemoryComponentRepository<ComponentType extends IDescribedComponent> implements IComponentRepository<ComponentType> {
	private final IMap<String, ComponentType> repo;

	private final String source;

	public MemoryComponentRepository(IMap<String, ComponentType> repo) {
		this(repo, "memory");
	}

	public MemoryComponentRepository(IMap<String, ComponentType> repo, String source) {
		this.repo = repo;

		this.source = source;
	}

	public IMap<String, ComponentType> getAll() {
		return repo;
	}

	public ComponentType getByName(String name) {
		return repo.get(name);
	}

	public String getSource() {
		return source;
	}
}