Rocker is a Java 8+ optimized, near zero-copy rendering, speedy template engine that produces statically typed, plain java object templates that are compiled along with the rest of your project. No more "warm-up" time in production, slow reflection-based logic, or nasty surprises that should have been caught during development.
Write your templates using an intuitive, tagless syntax
with standard Java expressions for logic, iteration, and values. Use Rocker's
special ? presence operator for null-safe evaluation. All the heavy
lifting is done by the Rocker parser during development -- which keeps the runtime
dependencies down to just a handful of classes. Rocker will parse your templates
and generate well-documented Java source files (so you can easily inspect and
understand how it works).
Includes the following features:
- Templates are runtime compatible with Java 8+ -- using Lambdas and type inference under-the-hood
- Near zero-copy rendering
- Hot reload support in two flavors
- Elegant, intuitive, tagless syntax that infers when your logic ends for control / dynamic content. All dynamic / control code uses standard Java syntax.
- A special
?presence operator extends syntax for simplified handling of null values. - Parsed templates become normal POJOs with defined arguments -- allowing you to tap into your IDEs code completion, syntax highlighting, etc.
- Support for injecting intermediate application-specific super classes during parsing & generating phase -- thereby creating your own app-specific template engine where you can make implicit variables/methods available to all templates.
- Since templates are just Java classes -- your logic / dynamic content can call out to any other Java code. Your templates can be as advanced or as simple as you need. No reflection used.
- No runtime configuration/engine required -- there isn't any sort of RockerEngine class required to execute templates. Each compiled template is ready-to-go and knows how to render itself.
- Templates retain enough information about the original template to throw exceptions at runtime (during render()) that let you track down the problematic line in the original template source file.
- GraalVM compatability if you leverage the new PlainText strategy of STATIC_BYTE_ARRAYS
