/** * Returns a map of module types to list of modules, excluding module types where retrieval failed, typically due * to validation errors. * * @param exceptionHandler the exception handler to invoke if an error occurred * @return the valid module lists */ public Map<String, List<ModuleBean>> getValidModuleLists(Consumer<Exception> exceptionHandler) { Optional<Consumer<Exception>> optionalExceptionHandler = Optional.of(exceptionHandler); for (String moduleType : moduleListSuppliers.keySet()) { loadExistingModuleList(moduleType, optionalExceptionHandler); } return Collections.unmodifiableMap(validModules); }
/** * Returns a list of modules of the given type, unless a validation error occurred when retrieving it. * * @param type the module type for which to return the list of modules * @param exceptionHandler the exception handler to invoke if an error occurred * @return a list of modules, or {@link Optional#empty()} if an error occurred */ public Optional<List<ModuleBean>> getValidModuleListOfType(String type, Consumer<Exception> exceptionHandler) { if (moduleListSuppliers.containsKey(type)) { return Optional.ofNullable(loadExistingModuleList(type, Optional.of(exceptionHandler))); } return Optional.empty(); }
/** * Returns a map of module types to list of modules, excluding module types where retrieval failed, typically due * to validation errors. * * @param exceptionHandler the exception handler to invoke if an error occurred * @return the valid module lists */ public Map<String, List<ModuleBean>> getValidModuleLists(Consumer<Exception> exceptionHandler) { Optional<Consumer<Exception>> optionalExceptionHandler = Optional.of(exceptionHandler); for (String moduleType : moduleListSuppliers.keySet()) { loadExistingModuleList(moduleType, optionalExceptionHandler); } return Collections.unmodifiableMap(validModules); }
/** * Returns a list of modules of the given type, unless a validation error occurred when retrieving it. * * @param type the module type for which to return the list of modules * @param exceptionHandler the exception handler to invoke if an error occurred * @return a list of modules, or {@link Optional#empty()} if an error occurred */ public Optional<List<ModuleBean>> getValidModuleListOfType(String type, Consumer<Exception> exceptionHandler) { if (moduleListSuppliers.containsKey(type)) { return Optional.ofNullable(loadExistingModuleList(type, Optional.of(exceptionHandler))); } return Optional.empty(); }