Evaluate go templates and make textual output.
Before then, there is another fine library with a name not so intuitive: Java Template Engine, you can choose that if you like.
This project is for experimental purpose, please DON'T USE IN PRODUCTION for now because the support for complex number and builtin functions is incomplete. Wish I can finish them ASAP.
You can see the changelog to know what's happening.
Java Version: >= 1.8
No other dependency required except for Vanilla Java
For Maven, you can simply add dependency:
<dependency>
<groupId>io.github.verils</groupId>
<artifactId>gotemplate4j</artifactId>
<version>0.3.1</version>
</dependency>
// Create a user as the input data
User user = new User();
user.setName("Bob");
// Prepare you template
Template template = new Template("demo");
template.parse("Hello, {{ .Name }}!");
// Execute and print out the result text
StringWriter writer = new StringWriter();
template.execute(writer, user);
System.out.print(writer.toString()); // "Hello Bob!"
- The format of print functions in Java are different from Golang
- Achieved only a few built-in functions
- The procedure of PipeNode is weak
- Support complex number format
- Support all built-in functions in Golang
- Complete PipeNode for all types of identifiers