Skip to content
Permalink
Browse files

Improved: Rewrite ‘ComponentConfig#getAllConfigurations’

(OFBIZ-11101)

It now has a stream based implementation.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1862216 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Jun 27, 2019
1 parent ecadb1a commit 23054085260fc31e5a35e3e4cf91a7e90c4821c4
Showing with 8 additions and 11 deletions.
  1. +8 −11 framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java
@@ -78,18 +78,15 @@ public static Boolean componentExists(String componentName) {
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) {

0 comments on commit 2305408

Please sign in to comment.
You can’t perform that action at this time.