Package com.github.jknack.handlebars.js
Class HandlebarsJs
- java.lang.Object
-
- com.github.jknack.handlebars.js.HandlebarsJs
-
@Deprecated(since="2022-05-05") public abstract class HandlebarsJs extends Object
Deprecated.com.github.jknack.handlebars.js package is deprecated and marked for removal in subsequent upgrades for handlebars.The main motivation ofHandlebarsJsis the ability of reuse JavaScript helpers in the server and the client.- Since:
- 1.1.0
-
-
Constructor Summary
Constructors Constructor Description HandlebarsJs(HelperRegistry helperRegistry)Deprecated.Creates a newHelperRegistryobject.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static HandlebarsJscreate(HelperRegistry helperRegistry)Deprecated.Creates aHandlebarsJsobject.static HandlebarsJscreateRhino(HelperRegistry helperRegistry, int optimizationLevel)Deprecated.Creates aHandlebarsJsobject.abstract voidregisterHelpers(String filename, String source)Deprecated.Register helpers from a JavaScript source.
-
-
-
Constructor Detail
-
HandlebarsJs
public HandlebarsJs(HelperRegistry helperRegistry)
Deprecated.Creates a newHelperRegistryobject.- Parameters:
helperRegistry- TheHelperRegistryinstance. Required.
-
-
Method Detail
-
registerHelpers
public abstract void registerHelpers(String filename, String source) throws Exception
Deprecated.Register helpers from a JavaScript source.
A JavaScript source file looks like:
Handlebars.registerHelper('hey', function (context) { return 'Hi ' + context.name; }); ... Handlebars.registerHelper('hey', function (context, options) { return 'Hi ' + context.name + options.hash['x']; }); ... Handlebars.registerHelper('hey', function (context, p1, p2, options) { return 'Hi ' + context.name + p1 + p2 + options.hash['x']; }); ...To keep your helpers reusable between server and client avoid DOM manipulation.- Parameters:
filename- The file name (just for debugging purpose). Required.source- The JavaScript source. Required.- Throws:
Exception- If the JavaScript helpers can't be registered.
-
create
public static HandlebarsJs create(HelperRegistry helperRegistry)
Deprecated.Creates aHandlebarsJsobject.- Parameters:
helperRegistry- The helperRegistry object. Required.- Returns:
- A new
HandlebarsJsobject.
-
createRhino
public static HandlebarsJs createRhino(HelperRegistry helperRegistry, int optimizationLevel)
Deprecated.Creates aHandlebarsJsobject.- Parameters:
helperRegistry- The helperRegistry object. Required.optimizationLevel- The optimization level of rhino.- Returns:
- A new
HandlebarsJsobject.
-
-