com.softicar.platform.common.io.resource.container.ResourceSupplierContainers Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-common Show documentation
Show all versions of platform-common Show documentation
The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.
package com.softicar.platform.common.io.resource.container;
import com.softicar.platform.common.core.java.classpath.IJavaClasspathRoot;
import com.softicar.platform.common.core.java.classpath.JavaClasspath;
import java.util.Collection;
import java.util.stream.Collectors;
/**
* Utility methods for {@link ResourceSupplierContainer} classes.
*
* @author Oliver Richers
*/
public class ResourceSupplierContainers {
public static Collection> findAll() {
return JavaClasspath//
.getInstance()
.getPayloadRoots()
.stream()
.map(IJavaClasspathRoot::getAnalyzedClasses)
.flatMap(Collection::stream)
.filter(javaClass -> javaClass.hasAnnotation(ResourceSupplierContainer.class))
.map(javaClass -> javaClass.loadClass())
.collect(Collectors.toList());
}
}