summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2016-10-21 14:14:48 -0400
committerbculkin2442 <bjculkin@mix.wvu.edu>2016-10-21 14:14:48 -0400
commit5cf7bcf156970fe72f79e40b8a6e320ea160ac83 (patch)
tree52bba3b684c493c726538194b5965150abb4a786 /BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java
parentb0516949d7577b809c75d7267df77bff2cdb078b (diff)
Documentation
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.java43
1 files changed, 21 insertions, 22 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 6c1bb71..e98c06b 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java
@@ -25,8 +25,7 @@ import bjc.utils.funcutils.FileUtils;
* @param <ComponentType>
* The type of component being read in
*/
-public class FileComponentRepository<
- ComponentType extends IDescribedComponent>
+public class FileComponentRepository<ComponentType extends IDescribedComponent>
implements IComponentRepository<ComponentType> {
// The logger to use for storing data about this class
private static final Logger CLASS_LOGGER = Logger
@@ -54,7 +53,9 @@ public class FileComponentRepository<
public FileComponentRepository(File directory,
Function<File, ? extends ComponentType> componentReader) {
// Make sure we have valid arguments
- if (!directory.isDirectory()) {
+ if (directory == null) {
+ throw new NullPointerException("Directory must not be null");
+ } else if (!directory.isDirectory()) {
throw new IllegalArgumentException("File " + directory
+ " is not a directory.\n"
+ "Components can only be read from a directory");
@@ -72,25 +73,23 @@ public class FileComponentRepository<
// Predicate to use to traverse all the files in a directory, but
// not recurse into sub-directories
- BiPredicate<Path,
- BasicFileAttributes> firstLevelTraverser = (pth, attr) -> {
- if (attr.isDirectory() && !isFirstDir.getValue()) {
-
- /*
- * Skip directories, they probably have component
- * support files.
- */
- return false;
- }
-
- /*
- * Don't skip the first directory, that's the parent
- * directory
- */
- isFirstDir.replace(false);
-
- return true;
- };
+ BiPredicate<Path, BasicFileAttributes> firstLevelTraverser = (pth,
+ attr) -> {
+ if (attr.isDirectory() && !isFirstDir.getValue()) {
+ /*
+ * Skip directories, they probably have component support
+ * files.
+ */
+ return false;
+ }
+
+ /*
+ * Don't skip the first directory, that's the parent directory
+ */
+ isFirstDir.replace(false);
+
+ return true;
+ };
// Try reading components
try {