Te4j (Template Engine For Java) - Fastest and easy template engine

Overview

Te4j

About the project

Te4j (Template Engine For Java) - Fastest and easy template engine

Pros

  • Extremely fast (127k renders per second on 4790K)
  • Easy and simple syntax
  • No dependencies

Cons (temporary)

  • No community :(
  • Sometimes really bad code
  • No javadocs
  • Poor documentation

Benchmarks

Click me

Example

<p>Message: ^^ message ^^p>
class Pojo {
    String getMessage() {
        return "Hello world!";
    }
}

Pojo pojo = new Pojo();

Template<Pojo> template = Te4j.load(Pojo.class, "index.html");
String result = template.renderAsString(pojo);
// result = 

Message: Hello world!

Also, you are able to create custom template context

TemplateContext ctx = Te4j.custom()
        // deletes repeating spaces, tabs, cr and lf from output
        .replace(Te4j.DEL_ALL)
        // you can choose which output type will be used
        // 
        // if you want to choose multiple output types,
        // you can use | operator
        //
        // BYTES - renderAsBytes and renderTo will be optimized
        // STRING - renderAsString will be optimized
        .outputTypes(Te4j.BYTES | Te4j.STRING)
        // btw you can enable hot reloading
        //
        // it does not impact performance,
        // but I recommend disabling it in production
        // for max. performance
        .enableHotReloading()
        .build();

Template<Pojo> template = ctx.load(Pojo.class, "index.html");

More examples in docs

Full Docs

Click me

Add as dependency

Maven

<dependencies>
    <dependency>
        <groupId>com.github.lero4ka16groupId>
        <artifactId>te4jartifactId>
        <version>1.1.1version>
    dependency>
dependencies>

Gradle

dependencies {
    implementation 'com.github.lero4ka16:te4j:1.1.1'
}

Build the project

  1. Execute ./gradlew build
  2. Output file located at build/libs/te4j.jar

Contact

Vkontakte, Telegram

Post Scriptum

I will be very glad if someone can help me with development.

You might also like...

Drools is a rule engine, DMN engine and complex event processing (CEP) engine for Java.

An open source rule engine, DMN engine and complex event processing (CEP) engine for Java™ and the JVM Platform. Drools is a business rule management

Dec 31, 2022

This template makes it easy to organize FTC code and allows for the Autonomous and TeleOp periods to share code.

FTC Code Organizer This template created by team 19458 Equilibrium.exe makes it easy to keep your code organized and allows the Autonomous and TeleOp

Nov 10, 2022

Easy-es - easy use for elastich search

Easy-es - easy use for elastich search

Born To Simplify Development What is Easy-Es? Easy-Es is a powerfully enhanced toolkit of RestHighLevelClient for simplify development. This toolkit p

Jan 6, 2023

MapDB provides concurrent Maps, Sets and Queues backed by disk storage or off-heap-memory. It is a fast and easy to use embedded Java database engine.

MapDB: database engine MapDB combines embedded database engine and Java collections. It is free under Apache 2 license. MapDB is flexible and can be u

Dec 30, 2022

MapDB provides concurrent Maps, Sets and Queues backed by disk storage or off-heap-memory. It is a fast and easy to use embedded Java database engine.

MapDB: database engine MapDB combines embedded database engine and Java collections. It is free under Apache 2 license. MapDB is flexible and can be u

Jan 1, 2023

jte is a secure and lightweight template engine for Java.

jte is a secure and lightweight template engine for Java.

jte is a secure and lightweight template engine for Java. All jte templates are compiled to Java class files, meaning jte adds essentially zero overhe

Dec 22, 2022

ST (StringTemplate) is a java template engine (with ports for C#, Python, and Objective-C coming) for generating source code

ST (StringTemplate) is a java template engine (with ports for C#, Python, and Objective-C coming) for generating source code, web pages, emails, or an

Jan 5, 2023

Java 8 optimized, memory efficient, speedy template engine producing statically typed, plain java objects

Java 8 optimized, memory efficient, speedy template engine producing statically typed, plain java objects

Rocker Templates by Fizzed Fizzed, Inc. (Follow on Twitter: @fizzed_inc) Sponsored by Rocker is proudly sponsored by Greenback. We love the service an

Dec 29, 2022

A query language for JSON and a template engine to generate text output.

Josson & Jossons Josson is a query language for JSON. Jossons is a template engine to generate text output. Features and Capabilities of Josson Query

Dec 14, 2022

Java modern template engine

Jtwig Project Documentation Project Status Coverage Version jtwig-reflection jtwig-core jtwig-web jtwig-pluralization jtwig-spring jtwig-translate-ext

May 19, 2022

A Java-based template project for the FastJ Game Engine.

A Java-based template project for the FastJ Game Engine.

FastJ Java Template Program Requirements Java 16 JDK Basic understanding of Java Initial Setup Download the Template You have a few options for gettin

May 15, 2022

Fast and Easy mapping from database and csv to POJO. A java micro ORM, lightweight alternative to iBatis and Hibernate. Fast Csv Parser and Csv Mapper

Simple Flat Mapper Release Notes Getting Started Docs Building it The build is using Maven. git clone https://github.com/arnaudroger/SimpleFlatMapper.

Dec 17, 2022

A small and easy-to-use one-time password generator library for Java according to RFC 4226 (HOTP) and RFC 6238 (TOTP).

OTP-Java A small and easy-to-use one-time password generator for Java according to RFC 4226 (HOTP) and RFC 6238 (TOTP). Table of Contents Features Ins

Dec 30, 2022

Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API.

Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API.

Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API.

Jan 4, 2023

A small and easy-to-use one-time password generator library for Java according to RFC 4226 (HOTP) and RFC 6238 (TOTP).

OTP-Java A small and easy-to-use one-time password generator for Java according to RFC 4226 (HOTP) and RFC 6238 (TOTP). Table of Contents Features Ins

Dec 30, 2022
Comments
  • Code Review (?)

    Code Review (?)

    https://github.com/lero4ka16/te4j/blob/512eed9cecbb8c651b34282545d74fdc36c74beb/src/main/java/com/github/lero4ka16/te4j/util/RuntimeJavaCompiler.java#L68

    You should probably just make the method synchronized instead of having a sync block on TMP as I assume #compile should only be accessed by one thread at any given moment anyway.

    https://github.com/lero4ka16/te4j/blob/512eed9cecbb8c651b34282545d74fdc36c74beb/src/main/java/com/github/lero4ka16/te4j/util/RuntimeJavaCompiler.java#L50-L66 This isn't thread safe! You synchronize the TMP variable but your superclass, interfaces and content variables can be concurrently modified during compilation!

    https://github.com/lero4ka16/te4j/blob/512eed9cecbb8c651b34282545d74fdc36c74beb/src/main/java/com/github/lero4ka16/te4j/util/RuntimeJavaCompiler.java#L100-L126

    What are you trying to do here? If you're validating the generated classes just check if the compiler failed. So: Based on Java 8 documentation for JavaCompiler

    int code = compiler#run(...)
    if (code != 0) {
       // some error in compilation
    }
    
    opened by md5sha256 6
Owner
Lero4ka16
Lero4ka16
ST (StringTemplate) is a java template engine (with ports for C#, Python, and Objective-C coming) for generating source code

ST (StringTemplate) is a java template engine (with ports for C#, Python, and Objective-C coming) for generating source code, web pages, emails, or an

Antlr Project 851 Jan 5, 2023
Java 8 optimized, memory efficient, speedy template engine producing statically typed, plain java objects

Rocker Templates by Fizzed Fizzed, Inc. (Follow on Twitter: @fizzed_inc) Sponsored by Rocker is proudly sponsored by Greenback. We love the service an

Fizzed, Inc. 669 Dec 29, 2022
Java modern template engine

Jtwig Project Documentation Project Status Coverage Version jtwig-reflection jtwig-core jtwig-web jtwig-pluralization jtwig-spring jtwig-translate-ext

Jtwig 298 May 19, 2022
Multiproject template for ForgeGradle development environments

ForgeGradle Multiproject Template This repository provides a template for multiproject development environments using ForgeGradle. Project structure T

Néstor Amador 10 Jun 3, 2022
A little template project to

FX Modules This is a little project that can be used as a template for modularized JavaFX projects. The main branch is based on JDK17, other version c

Gerrit Grunwald 27 Dec 12, 2022
Pebble is a java templating engine inspired by Twig

Pebble Pebble is a java templating engine inspired by Twig. It separates itself from the crowd with its inheritance feature and its easy-to-read synta

null 985 Dec 23, 2022
a pug implementation written in Java (formerly known as jade)

Attention: jade4j is now pug4j In alignment with the javascript template engine we renamed jade4j to pug4j. You will find it under https://github.com/

neuland - Büro für Informatik 700 Oct 16, 2022
BenDB - An fastest, qualified & easy to use multi database library

BenDB - An fastest, qualified & easy to use multi database library

Fitchle 2 May 3, 2022
Apache ORC - the smallest, fastest columnar storage for Hadoop workloads

Apache ORC ORC is a self-describing type-aware columnar file format designed for Hadoop workloads. It is optimized for large streaming reads, but with

The Apache Software Foundation 576 Jan 2, 2023
A MOTD plugin for Velocity that caches network packets. This helps it be the fastest one of the MOTD plugins.

FastMOTD A MOTD plugin for Velocity that catches network packets. This helps it be the fastest one of the MOTD plugins. Test server: ely.su Features F

Elytrium 19 Dec 24, 2022