public interface HelperRegistry
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
HELPER_MISSING
The missing helper's name.
|
Modifier and Type | Method and Description |
---|---|
Decorator |
decorator(java.lang.String name)
Find a decorator by name.
|
<C> Helper<C> |
helper(java.lang.String name)
Find a helper by name.
|
java.util.Set<java.util.Map.Entry<java.lang.String,Helper<?>>> |
helpers()
List all the helpers from registry.
|
HelperRegistry |
registerDecorator(java.lang.String name,
Decorator decorator)
Register a decorator and make it accessible via
decorator(String) . |
<H> HelperRegistry |
registerHelper(java.lang.String name,
Helper<H> helper)
Register a helper in the helper registry.
|
<H> HelperRegistry |
registerHelperMissing(Helper<H> helper)
Register the special helper missing in the registry.
|
HelperRegistry |
registerHelpers(java.lang.Class<?> helperSource)
Register all the helper methods for the given helper source.
|
HelperRegistry |
registerHelpers(java.io.File input)
Register helpers from a JavaScript source.
|
HelperRegistry |
registerHelpers(java.lang.Object helperSource)
Register all the helper methods for the given helper source.
|
HelperRegistry |
registerHelpers(java.lang.String filename,
java.io.InputStream source)
Register helpers from a JavaScript source.
|
HelperRegistry |
registerHelpers(java.lang.String filename,
java.io.Reader source)
Register helpers from a JavaScript source.
|
HelperRegistry |
registerHelpers(java.lang.String filename,
java.lang.String source)
Register helpers from a JavaScript source.
|
HelperRegistry |
registerHelpers(java.net.URI location)
Register helpers from a JavaScript source.
|
static final java.lang.String HELPER_MISSING
<C> Helper<C> helper(java.lang.String name)
C
- The helper runtime type.name
- The helper's name. Required.java.util.Set<java.util.Map.Entry<java.lang.String,Helper<?>>> helpers()
<H> HelperRegistry registerHelper(java.lang.String name, Helper<H> helper)
H
- The helper runtime type.name
- The helper's name. Required.helper
- The helper object. Required.<H> HelperRegistry registerHelperMissing(Helper<H> helper)
H
- The helper runtime type.helper
- The helper object. Required.HelperRegistry registerHelpers(java.lang.Object helperSource)
Register all the helper methods for the given helper source.
A helper method looks like:
public static? CharSequence methodName(context?, parameter*, options?) { }Where:
helperSource
- The helper source. Required.HelperRegistry registerHelpers(java.lang.Class<?> helperSource)
Register all the helper methods for the given helper source.
A helper method looks like:
public static? CharSequence methodName(context?, parameter*, options?) { }Where:
Enums are supported too
helperSource
- The helper source. Enums are supported. Required.HelperRegistry registerHelpers(java.net.URI location) throws java.lang.Exception
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.
location
- A classpath location. Required.java.lang.Exception
- If the JavaScript helpers can't be registered.HelperRegistry registerHelpers(java.io.File input) throws java.lang.Exception
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.
input
- A JavaScript file name. Required.java.lang.Exception
- If the JavaScript helpers can't be registered.HelperRegistry registerHelpers(java.lang.String filename, java.io.Reader source) throws java.lang.Exception
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.
filename
- The file name (just for debugging purpose). Required.source
- The JavaScript source. Required.java.lang.Exception
- If the JavaScript helpers can't be registered.HelperRegistry registerHelpers(java.lang.String filename, java.io.InputStream source) throws java.lang.Exception
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.
filename
- The file name (just for debugging purpose). Required.source
- The JavaScript source. Required.java.lang.Exception
- If the JavaScript helpers can't be registered.HelperRegistry registerHelpers(java.lang.String filename, java.lang.String source) throws java.lang.Exception
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.
filename
- The file name (just for debugging purpose). Required.source
- The JavaScript source. Required.java.lang.Exception
- If the JavaScript helpers can't be registered.Decorator decorator(java.lang.String name)
name
- A decorator's name.null
.HelperRegistry registerDecorator(java.lang.String name, Decorator decorator)
decorator(String)
.name
- A decorator's name. Required.decorator
- A decorator. Required.Copyright © 2010 - 2020 Adobe. All Rights Reserved