public class Rockerby extends Object implements org.jooby.Jooby.Module
Java 8 optimized, memory efficient, speedy template engine producing statically typed, plain java objects.
Rocker is a Java 8 optimized (runtime compat with 6+), 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.
{
use(new Rockerby());
// Rocker API:
get("/", () -> views.index.template("Rocker"));
}
Rocker support two flavors. The one showed before is the recommend way of using Rocker.
The static, efficient and type-safe flavor:
{
use(new Rockerby());
get("/", () -> views.index.template("Rocker"));
}
The dynamic flavor is available via View objects:
{
use(new Rockerby());
get("/", () -> Results.html("views/index").put("message", "Rocker"));
}
This is just syntax sugar for:
{
use(new Rockerby());
get("/", () -> {
return Rocker.template("views/index.rocker.html").bind("message", "Rocker");
});
}
We do provide code generation via Maven profile. All you have to do is to write a
rocker.activator file inside the src/etc folder. File presence triggers
generation of source code.
Please refer to Rocker documentation for Gradle.
You don't need Rocker hot reload as
long as you start your application in development with
jooby:run. Because
jooby:run already restart the application on
class changes.
That's all folks!!
| Constructor and Description |
|---|
Rockerby()
Creates a new
Rockerby. |
Rockerby(String prefix)
Creates a new
Rockerby. |
Rockerby(String prefix,
String suffix)
Creates a new
Rockerby. |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(org.jooby.Env env,
com.typesafe.config.Config conf,
com.google.inject.Binder binder) |
public Rockerby(String prefix, String suffix)
Rockerby.prefix - Template prefix.suffix - Template suffix.public Rockerby(String prefix)
Rockerby.prefix - Template prefix.public Rockerby()
Rockerby.Copyright © 2020. All rights reserved.