private Meta<T> load(String filePath) { final MessageDigest digest; try { digest = MessageDigest.getInstance("SHA-256"); } catch (Exception e) { throw new IllegalStateException("Couldn't load config from file '" + filePath + "'", e); } try { File file = new File(filePath); T value = factory.apply(parse(file)); digest.update(Files.readAllBytes(Paths.get(filePath))); return new Meta<>(value, file.getAbsolutePath(), file.lastModified(), digest.digest()); } catch (Exception e) { throw new IllegalStateException("Couldn't load config from file '" + filePath + "'", e); } }