summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/components/IComponentRepository.java
diff options
context:
space:
mode:
authorBenjamin J. Culkin <bjculkin@mix.wvu.edu>2017-10-08 22:39:59 -0300
committerBenjamin J. Culkin <bjculkin@mix.wvu.edu>2017-10-08 22:39:59 -0300
commitc82e3b3b2de0633317ec8fc85925e91422820597 (patch)
tree96567416ce23c5ce85601f9cedc3a94bb1c55cba /base/src/main/java/bjc/utils/components/IComponentRepository.java
parentb3ac1c8690c3e14c879913e5dcc03a5f5e14876e (diff)
Start splitting into maven modules
Diffstat (limited to 'base/src/main/java/bjc/utils/components/IComponentRepository.java')
-rw-r--r--base/src/main/java/bjc/utils/components/IComponentRepository.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/base/src/main/java/bjc/utils/components/IComponentRepository.java b/base/src/main/java/bjc/utils/components/IComponentRepository.java
new file mode 100644
index 0000000..6ee51f3
--- /dev/null
+++ b/base/src/main/java/bjc/utils/components/IComponentRepository.java
@@ -0,0 +1,49 @@
+package bjc.utils.components;
+
+import bjc.utils.funcdata.IList;
+import bjc.utils.funcdata.IMap;
+
+/**
+ * A collection of implementations of a particular type of
+ * {@link IDescribedComponent}
+ *
+ * @author ben
+ *
+ * @param <ComponentType>
+ * The type of components contained in this repository
+ */
+public interface IComponentRepository<ComponentType extends IDescribedComponent> {
+ /**
+ * 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 IMap<String, ComponentType> getAll();
+
+ /**
+ * 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 ComponentType getByName(String name);
+
+ /**
+ * Get a list of all the registered components
+ *
+ * @return A list of all the registered components
+ */
+ public default IList<ComponentType> getList() {
+ return getAll().valueList();
+ }
+
+ /**
+ * Get the source from which these components came
+ *
+ * @return The source from which these components came
+ */
+ public String getSource();
+} \ No newline at end of file