summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/components/ComponentRepository.java
diff options
context:
space:
mode:
authorBen Culkin <scorpress@gmail.com>2020-12-03 19:28:15 -0500
committerBen Culkin <scorpress@gmail.com>2020-12-03 19:28:15 -0500
commitf3814a84f8471684cd483347db4fb7b107c2e635 (patch)
tree7ed1061ee69ef50cd1494cfacc866b271b8d1163 /base/src/main/java/bjc/utils/components/ComponentRepository.java
parenta2c7425458f645802a352abc4783e0afc73dba13 (diff)
Rename interfaces to match Java style
Rename several interfaces that were in the style IWhatever, which Java doesn't use
Diffstat (limited to 'base/src/main/java/bjc/utils/components/ComponentRepository.java')
-rw-r--r--base/src/main/java/bjc/utils/components/ComponentRepository.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/base/src/main/java/bjc/utils/components/ComponentRepository.java b/base/src/main/java/bjc/utils/components/ComponentRepository.java
new file mode 100644
index 0000000..120edc8
--- /dev/null
+++ b/base/src/main/java/bjc/utils/components/ComponentRepository.java
@@ -0,0 +1,49 @@
+package bjc.utils.components;
+
+import bjc.funcdata.ListEx;
+import bjc.funcdata.MapEx;
+
+/**
+ * A collection of implementations of a particular type of
+ * {@link DescribedComponent}.
+ *
+ * @author ben
+ *
+ * @param <ComponentType>
+ * The type of components contained in this repository.
+ */
+public interface ComponentRepository<ComponentType extends DescribedComponent> {
+ /**
+ * 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 MapEx<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 ListEx<ComponentType> getList() {
+ return getAll().valueList();
+ }
+
+ /**
+ * Get the source from which these components came.
+ *
+ * @return The source from which these components came.
+ */
+ public String getSource();
+}