From 5cf7bcf156970fe72f79e40b8a6e320ea160ac83 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Fri, 21 Oct 2016 14:14:48 -0400 Subject: Documentation --- .../utils/components/FileComponentRepository.java | 43 +++++++++++----------- 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/components/FileComponentRepository.java') 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 * The type of component being read in */ -public class FileComponentRepository< - ComponentType extends IDescribedComponent> +public class FileComponentRepository implements IComponentRepository { // 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 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 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 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 { -- cgit v1.2.3