| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
BPJ is a Java 17+ interpolation library that lets you write readable placeholders like {name}, {product.value} and {user.getName()} in print, println, and format.
flowchart LR
A["BPJ.println('Hello {user.name}')"] --> B{"Plugin active?"}
B -->|No| C["Use explicit context overloads"]
B -->|Yes| D["Build rewrites source and injects context"]
C --> E["Resolved runtime output"]
D --> E
<dependency>
<groupId>io.github.oriontheprogrammer</groupId>
<artifactId>bpj</artifactId>
<version>0.3.1</version>
</dependency>implementation "io.github.oriontheprogrammer:bpj:0.3.1"Option A (bpj-starter-parent, easiest):
<parent>
<groupId>io.github.oriontheprogrammer</groupId>
<artifactId>bpj-starter-parent</artifactId>
<version>0.3.1</version>
</parent>Option B (bpj-spring-boot-parent, Spring Boot friendly):
<parent>
<groupId>io.github.oriontheprogrammer</groupId>
<artifactId>bpj-spring-boot-parent</artifactId>
<version>0.3.1</version>
</parent>Option C (manual plugin, for custom parent including spring-boot-starter-parent):
<build>
<plugins>
<plugin>
<groupId>io.github.oriontheprogrammer</groupId>
<artifactId>bpj-maven-plugin</artifactId>
<version>0.3.1</version>
<executions>
<execution>
<goals>
<goal>prepare</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>Recommended plugin DSL:
// settings.gradle
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
}// build.gradle
plugins {
id "java"
id "io.github.oriontheprogrammer.bpj" version "0.3.1"
}
repositories {
mavenCentral()
}
dependencies {
implementation "io.github.oriontheprogrammer:bpj:0.3.1"
}Legacy buildscript mode is still supported. See docs below.
Use this section if you want one-argument BPJ calls like:
BPJ.println("Hello {name}");to resolve values automatically.
mvn clean compileThen verify generated files exist in:
plugins {
id "java"
id "io.github.oriontheprogrammer.bpj" version "0.3.1"
}./gradlew clean compileJavaThen verify generated files exist in:
If you run main() directly from IDE without delegated Maven/Gradle build, transformation may be skipped. Run from terminal or enable delegated build/run in your IDE.
In Java, this is invalid inside static methods. Prefer:
BPJ.print("El error es: {e}");with plugin activation, or explicit map context if plugin is disabled.
Compatibility behavior:
| Mode | Example | Notes |
|---|---|---|
| Plugin OFF (explicit context) | BPJ.format("Hello {name}", Map.of("name", name)) | Always works, no source rewrite needed |
| Plugin OFF (object root) | BPJ.format("User: {name}", this) | Resolves from object fields/getters |
| Plugin ON (auto injection) | BPJ.format("Hello {name}") | Build plugin injects context automatically |
| Plugin ON (print) | BPJ.println("Welcome {user.name}") | Clean one-argument style |
String text = BPJ.format("Product value: {product.value}", Map.of("product", product));
String text2 = BPJ.format("Hello {name}, age {age}", "name", name, "age", age);
BPJ.println("Welcome {name}", this);BPJ.println("Hello {name}");
BPJ.println("Welcome {user.name}");
BPJ.println("Method call: {user.getName()}");
String text = BPJ.format("Final price: {finalPrice}");BPJ works for returned values, not only console output:
public String retornarTexto(String name, int edad) {
return BPJ.format("Hola {name}, tienes {edad}");
}Important:
Maven:
mvn clean compileCheck generated sources:
Gradle:
./gradlew clean compileJavaCheck generated sources:
Badges and icons are powered by:
| Back | FazBrowse Home | New Git URL |