summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java
diff options
context:
space:
mode:
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java48
1 files changed, 24 insertions, 24 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java b/BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java
index 8b0d303..bc1b990 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java
@@ -98,27 +98,9 @@ public class FileComponentRepository<E extends IDescribedComponent>
}
}
- private void loadComponent(Function<File, E> componentReader,
- Path pth) {
- try {
- E component = componentReader.apply(pth.toFile());
-
- if (component == null) {
- throw new NullPointerException(
- "Component reader read null component");
- } else if (!components.containsKey(component.getName())) {
- components.put(component.getName(), component);
- } else {
- CLASS_LOGGER.warn("Found a duplicate component.\n"
- + "Multiple versions of the same component are not currently supported.\n"
- + "The component" + component
- + " will not be registered .");
- }
- } catch (Exception ex) {
- CLASS_LOGGER.warn("Error found reading component from file "
- + pth.toString()
- + ". This component will not be loaded", ex);
- }
+ @Override
+ public E getComponentByName(String name) {
+ return components.get(name);
}
@Override
@@ -141,8 +123,26 @@ public class FileComponentRepository<E extends IDescribedComponent>
return "Components read from directory " + sourceDirectory + ".";
}
- @Override
- public E getComponentByName(String name) {
- return components.get(name);
+ private void loadComponent(Function<File, E> componentReader,
+ Path pth) {
+ try {
+ E component = componentReader.apply(pth.toFile());
+
+ if (component == null) {
+ throw new NullPointerException(
+ "Component reader read null component");
+ } else if (!components.containsKey(component.getName())) {
+ components.put(component.getName(), component);
+ } else {
+ CLASS_LOGGER.warn("Found a duplicate component.\n"
+ + "Multiple versions of the same component are not currently supported.\n"
+ + "The component" + component
+ + " will not be registered .");
+ }
+ } catch (Exception ex) {
+ CLASS_LOGGER.warn("Error found reading component from file "
+ + pth.toString()
+ + ". This component will not be loaded", ex);
+ }
}
} \ No newline at end of file