svn commit: r1862215 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1862215 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java

mthl
Author: mthl
Date: Thu Jun 27 14:19:56 2019
New Revision: 1862215

URL: http://svn.apache.org/viewvc?rev=1862215&view=rev
Log:
Improved: Rewrite ‘ComponentConfig#getAllClasspathInfos’
(OFBIZ-11101)

It now has a stream based implementation.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java?rev=1862215&r1=1862214&r2=1862215&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java Thu Jun 27 14:19:56 2019
@@ -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<ClasspathInfo> getAllClasspathInfos() {
-        return getAllClasspathInfos(null);
-    }
-
-    public static List<ClasspathInfo> getAllClasspathInfos(String componentName) {
-        List<ClasspathInfo> 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<ComponentConfig> getAllComponents() {