summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/components/IComponentRepository.java
blob: 6780f2e01413abbede511c7fa1e4d86559d74dc3 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package bjc.utils.components;

import bjc.utils.funcdata.IFunctionalList;
import bjc.utils.funcdata.IFunctionalMap;

/**
 * A collection of implementations of {@link IDescribedComponent}
 * 
 * @author ben
 *
 * @param <E>
 *            The type of components contained in this repository
 */
public interface IComponentRepository<E extends IDescribedComponent> {
	/**
	 * Get a component with a specific name
	 * 
	 * @param name
	 *            The name of the component to retrieve
	 * @return The named component, or null if no component with that name
	 *         exists
	 */
	public E getComponentByName(String name);

	/**
	 * Get a list of all the registered componets
	 * 
	 * @return A list of all the registered components
	 */
	public default IFunctionalList<E> getComponentList() {
		return getComponents().valueList();
	}

	/**
	 * Get all of the components this repository knows about
	 * 
	 * @return A map from component name to component, containing all of
	 *         the components in the repositories
	 */
	public IFunctionalMap<String, E> getComponents();

	/**
	 * Get the source from which these components came
	 * 
	 * @return The source from which these components came
	 */
	public String getSource();
}