-
-
Notifications
You must be signed in to change notification settings - Fork 22
Home
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).
Below you will find how to include the library in your projects and a simple code example. In the right side links you will find examples about the ClassHunter, ClassPathHunter, ClassFactory (for generating classes at runtime or for executing stringified code) and of some components. Here you can find some junit tests of the ClassHunter and here you can find some junit test of all most used components.
For assistance see the related section on the home page.
To include Burningwave Core library in your projects simply use with Apache Maven:
<dependency>
<groupId>org.burningwave</groupId>
<artifactId>core</artifactId>
<version>12.65.2</version>
</dependency>
To use Burningwave Core as a Java module add the following to your module-info.java
:
requires io.github.toolfactory.narcissus;
requires org.burningwave.core;
import java.util.Collection;
import org.burningwave.core.assembler.ComponentContainer;
import org.burningwave.core.assembler.ComponentSupplier;
import org.burningwave.core.classes.ClassHunter;
import org.burningwave.core.classes.SearchConfig;
import org.burningwave.core.io.PathHelper;
public class Finder {
public Collection<Class<?>> find() {
ComponentSupplier componentSupplier = ComponentContainer.getInstance();
PathHelper pathHelper = componentSupplier.getPathHelper();
ClassHunter classHunter = componentSupplier.getClassHunter();
SearchConfig searchConfig = 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 Classpaths
pathHelper.getMainClassPaths()
);
try (ClassHunter.SearchResult searchResult = classHunter.find()) {
return searchResult.getClasses();
}
}
}
Burningwave core is a fully indipendent, advanced, free and open source Java frameworks building library that contains AN EXTREMELY POWERFUL CLASSPATH SCANNER.
To include Burningwave Core library in your projects simply use with Apache Maven:
<dependency>
<groupId>org.burningwave</groupId>
<artifactId>core</artifactId>
<version>12.65.2</version>
</dependency>
To use Burningwave Core as a Java module add the following to your module-info.java
:
requires org.burningwave.core;
ClassFactory
ClassHunter
- In depth look to and configuration guide
- USE CASE: retrieving all classes of the classpath
- USE CASE: retrieving all classes that implement one or more interfaces
- USE CASE: finding all classes that extend a base class
- USE CASE: searching for all classes that have package name that matches a regex
- USE CASE: finding all classes for module name (Java 9 and later)
- USE CASE: finding all annotated classes
- USE CASE: how to scan classes for specific annotations and collect its values
- USE CASE: searching for all classes with a constructor that takes a specific type as first parameter and with at least 2 methods that begin for a given string
- USE CASE: searching for all classes with methods whose name begins for a given string and that takes a specific type as its first parameter
- USE CASE: finding all classes that have at least 2 protected fields