Skip to content
Permalink
Browse files

Improved: Rewrite ‘ComponentConfig#getAllClasspathInfos’

(OFBIZ-11101)

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
  • Loading branch information
mthl committed Jun 27, 2019
1 parent be99f5a commit ecadb1aac1a36572892a99048cc4dca4fde8f6d5
Showing with 8 additions and 11 deletions.
  1. +8 −11 framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java
@@ -63,18 +63,15 @@ public static Boolean componentExists(String componentName) {
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() {

0 comments on commit ecadb1a

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