You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Burningwave Core is an advanced and highly optimized Java library to build frameworks and it is useful for scanning class paths, generating classes at runtime, facilitating the use of reflection, scanning the filesystem, executing stringified source code and much more…
With it it's possible to search classes by every criteria that your imagination can make by using lambda expressions. Scan engine is highly optimized using direct allocated ByteBuffers to avoid heap saturation; searches are executed in multithreading context and are not affected by "the issue of the same class loaded by different classloaders" (normally if you try to execute "isAssignableFrom" method on a same class loaded from different classloader it returns false).
... And now the code: let's retrieve all classes of the runtime classpath!
importjava.util.Collection;
importorg.burningwave.core.assembler.ComponentContainer;
importorg.burningwave.core.assembler.ComponentSupplier;
importorg.burningwave.core.classes.ClassHunter;
importorg.burningwave.core.classes.SearchConfig;
importorg.burningwave.core.io.PathHelper;
publicclassFinder {
publicCollection<Class<?>> find() {
ComponentSuppliercomponentSupplier = ComponentContainer.getInstance();
PathHelperpathHelper = componentSupplier.getPathHelper();
ClassHunterclassHunter = componentSupplier.getClassHunter();
SearchConfigsearchConfig = SearchConfig.forPaths(
//Here you can add all absolute path you want://both folders, zip, jar, war, ear and jmod will be recursively scanned.//For example you can add: "C:\\Users\\user\\.m2"//With the row below the search will be executed on runtime ClasspathspathHelper.getMainClassPaths()
);
try (ClassHunter.SearchResultsearchResult = classHunter.find()) {
returnsearchResult.getClasses();
}
}
}