Blueprint is a simple, annotation-driven library for modifying Java code at runtime
Currently, Blueprint is not hosted on any Maven repositories, so you must download the source and manually compile it. This README will be updated to reflect whether or not that changes.
To include it as a dependency, either directly add the JAR or add the following dependecy to your POM.
<dependency>
<groupId>io.github.wordandahalf</groupId>
<artifactId>Blueprint</artifactId>
<version>0.1.0</version>
</dependency>
Here is a simple example of how to utilize Blueprint:
package blueprintTest;
public class Foo {
private String text;
public Foo() { this.text = "Hello, foo!"; }
public void getFoo() { System.out.println(this.text); }
}
package blueprintTest;
@Blueprint(target = "blueprintTest.Foo")
public class BlueprintTest {
public static void main(String[] args) throws Exception {
Blueprints.add(BlueprintTest.class);
Blueprints.apply();
Foo foo = new Foo();
foo.getFoo();
}
@Inject(target = "getFoo", at = @At(location = At.Location.TAIL))
public void getFoo() {
System.out.println("Hello, world!");
}
}
When ran, this program will have the output:
Hello, foo!
Hello, world!
For more extensive documentation and examples, please see the Wiki