From ecadb1aac1a36572892a99048cc4dca4fde8f6d5 Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Thu, 27 Jun 2019 14:19:56 +0000 Subject: [PATCH] =?UTF-8?q?Improved:=20Rewrite=20=E2=80=98ComponentConfig#?= =?UTF-8?q?getAllClasspathInfos=E2=80=99=20(OFBIZ-11101)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It now has a stream based implementation. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1862215 13f79535-47bb-0310-9956-ffa450edef68 --- .../ofbiz/base/component/ComponentConfig.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java b/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java index 176db70115..1551514a8e 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java @@ -63,18 +63,15 @@ public final class ComponentConfig { return componentConfigCache.fromGlobalName(componentName) != null; } + /** + * Provides the list of all the classpath information available in components. + * + * @return a list of classpath information + */ public static List getAllClasspathInfos() { - return getAllClasspathInfos(null); - } - - public static List getAllClasspathInfos(String componentName) { - List classpaths = new ArrayList<>(); - for (ComponentConfig cc : getAllComponents()) { - if (componentName == null || componentName.equals(cc.getComponentName())) { - classpaths.addAll(cc.getClasspathInfos()); - } - } - return classpaths; + return getAllComponents().stream() + .flatMap(cc -> cc.getClasspathInfos().stream()) + .collect(Collectors.toList()); } public static Collection getAllComponents() {