svn commit: r1862216 - /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: r1862216 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java

mthl
Author: mthl
Date: Thu Jun 27 14:22:03 2019
New Revision: 1862216

URL: http://svn.apache.org/viewvc?rev=1862216&view=rev
Log:
Improved: Rewrite ‘ComponentConfig#getAllConfigurations’
(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=1862216&r1=1862215&r2=1862216&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:22:03 2019
@@ -78,18 +78,15 @@ public final class ComponentConfig {
         return componentConfigCache.values();
     }
 
+    /**
+     * Provides the list of all the container configuration elements available in components.
+     *
+     * @return a list of container configuration elements
+     */
     public static List<ContainerConfig.Configuration> getAllConfigurations() {
-        return getAllConfigurations(null);
-    }
-
-    public static List<ContainerConfig.Configuration> getAllConfigurations(String componentName) {
-        List<ContainerConfig.Configuration> configurations = new ArrayList<>();
-        for (ComponentConfig cc : getAllComponents()) {
-            if (componentName == null || componentName.equals(cc.getComponentName())) {
-                configurations.addAll(cc.getConfigurations());
-            }
-        }
-        return configurations;
+        return getAllComponents().stream()
+                .flatMap(cc -> cc.getConfigurations().stream())
+                .collect(Collectors.toList());
     }
 
     public static List<EntityResourceInfo> getAllEntityResourceInfos(String type) {