Package | Description |
---|---|
org.trimou.engine | |
org.trimou.engine.config | |
org.trimou.handlebars | |
org.trimou.handlebars.i18n |
Modifier and Type | Method and Description |
---|---|
Map<String,Helper> |
MustacheEngineBuilder.buildHelpers() |
Modifier and Type | Method and Description |
---|---|
MustacheEngineBuilder |
MustacheEngineBuilder.registerHelper(String name,
Helper helper)
Each helper must be registered with a unique name.
|
MustacheEngineBuilder |
MustacheEngineBuilder.registerHelper(String name,
Helper helper,
boolean overwrite)
Each helper must be registered with a unique name.
|
Modifier and Type | Method and Description |
---|---|
MustacheEngineBuilder |
MustacheEngineBuilder.registerHelpers(Map<String,Helper> helpers)
Each helper must be registered with a unique name.
|
MustacheEngineBuilder |
MustacheEngineBuilder.registerHelpers(Map<String,Helper> helpers,
boolean overwrite)
Each helper must be registered with a unique name.
|
Modifier and Type | Method and Description |
---|---|
Map<String,Helper> |
Configuration.getHelpers() |
Modifier and Type | Method and Description |
---|---|
static void |
ConfigurationExtensions.registerHelper(ConfigurationExtension.ConfigurationExtensionBuilder builder,
String name,
Helper helper)
Register helpers and do nothing if a helper with the same name is already registered.
|
ConfigurationExtension.ConfigurationExtensionBuilder |
ConfigurationExtension.ConfigurationExtensionBuilder.registerHelper(String name,
Helper helper)
Register a helper instance.
|
ConfigurationExtension.ConfigurationExtensionBuilder |
ConfigurationExtension.ConfigurationExtensionBuilder.registerHelper(String name,
Helper helper,
boolean overwrite)
Register a helper instance.
|
Modifier and Type | Method and Description |
---|---|
static void |
ConfigurationExtensions.registerHelpers(ConfigurationExtension.ConfigurationExtensionBuilder builder,
Map<String,Helper> helpers)
Register helper and do nothing if a helper with the same name is already registered.
|
ConfigurationExtension.ConfigurationExtensionBuilder |
ConfigurationExtension.ConfigurationExtensionBuilder.registerHelpers(Map<String,Helper> helpers)
Register all the helper instances.
|
ConfigurationExtension.ConfigurationExtensionBuilder |
ConfigurationExtension.ConfigurationExtensionBuilder.registerHelpers(Map<String,Helper> helpers,
boolean overwrite)
Register all the helper instances.
|
Modifier and Type | Class and Description |
---|---|
class |
AbstractHelper
An abstract helper that holds a reference to the
TextSupport . |
class |
AlternativesHelper
Selects one object from the set of alternatives (usually helper parameters)
and:
for variable - renders its
Object.toString() value or if no such object
exists renders the output of
MissingValueHandler.handle(org.trimou.engine.MustacheTagInfo)
for section - pushes the object on the context stack or does nothing if
no such object exists
If no AlternativesHelper.Selector instance is declared the default behavior is: take the
first parameter matching the condition (by default not null or not empty for
an instance of String ). |
class |
AsyncHelper
A simple helper whose content is rendered asynchronously.
|
class |
BasicSectionHelper |
class |
BasicValueHelper |
class |
BasicHelper
Basic validating helper.
|
class |
CacheHelper
Allows to cache template fragments in memory.
|
class |
EachHelper
Iterates over the params or the object at the top of the context stack.
|
class |
EmbedHelper
Embed the template source.
|
class |
EqualsHelper
Renders a block if the first param does/doesn't equal to the
second param (by means of
Object.equals(Object) ). |
class |
EvalHelper
Allows to build the key dynamically and evaluate it afterwards.
|
class |
FormatHelper
A simple printf-style format helper.
|
class |
ChooseHelper
This helper works similarly as the JSP c:choose tag.
|
static class |
ChooseHelper.OtherwiseHelper |
static class |
ChooseHelper.WhenHelper
The first param is the test condition.
|
class |
IfHelper
Renders a block if the param is not "falsy".
|
class |
IncludeHelper
Works similarly as partial tag except the name of the template to include may
be obtained dynamically.
|
class |
InvokeHelper
Invokes public methods with parameters via reflection.
|
class |
IsHelper
Renders the second param if the first param is not falsy, or (optionally,
i.e. if set) the third param.
|
class |
JoinHelper
This helper takes all the objects specified as the parameters and joins the
Object.toString() values together with the specified delimiter
(optional). |
class |
LogHelper
A simple log helper.
|
class |
NullCheckHelper
Renders a block if the param is/isn't null.
|
class |
NumberIsEvenHelper
{{isEven iterIndex "evenRow"}}
{{isEven iterIndex "evenRow" "oddRow"}}
{{#isEven iterIndex}}
... |
class |
NumberIsOddHelper
{{isOdd iterIndex "oddRow"}}
{{isOdd iterIndex "oddRow" "evenRow"}}
{{#isOdd iterIndex}}
... |
class |
NumberMatchingHelper
An abstract helper for matching
Number values. |
class |
NumericExpressionHelper
A simple numeric expression helper.
|
class |
RepeatHelper
Allows to repeat the section multiple times:
{{#repeat times=3}}
Hello three times!
|
class |
SetHelper
Works similarly as
WithHelper except the current
HelperDefinition.getHash() map is pushed on the context stack. |
class |
SwitchHelper
This helper works similarly as the Java switch statement.
|
static class |
SwitchHelper.CaseHelper
The first param is the matching value.
|
static class |
SwitchHelper.DefaultHelper |
class |
TagHelper
This helper allows to easily render tags which make use of the same
delimiters as Trimou does (i.e. would be normally parsed as mustache tags).
|
class |
UnlessHelper
Renders a block if the param is "falsy".
|
class |
WithHelper
Nested context.
|
Modifier and Type | Method and Description |
---|---|
Helper |
SimpleHelpers.Builder.build() |
static Helper |
SimpleHelpers.execute(BiConsumer<Options,Configuration> executionCallback) |
Modifier and Type | Method and Description |
---|---|
Map<String,Helper> |
HelpersBuilder.build() |
Modifier and Type | Method and Description |
---|---|
HelpersBuilder |
HelpersBuilder.add(String name,
Helper helper) |
Modifier and Type | Method and Description |
---|---|
static void |
NumericExpressionHelper.forEachOperator(BiConsumer<String,Helper> consumer)
Invokes the specified consumer for all operators.
|
static void |
HelperValidator.checkHash(Class<? extends Helper> helperClazz,
HelperDefinition definition,
int hashSize) |
static void |
HelperValidator.checkParams(Class<? extends Helper> helperClazz,
HelperDefinition definition,
int paramSize) |
static void |
HelperValidator.checkType(Class<? extends Helper> helperClazz,
HelperDefinition definition,
MustacheTagType... allowedTypes) |
static MustacheException |
HelperValidator.newValidationException(String msg,
Class<? extends Helper> helperClazz,
HelperDefinition definition) |
Modifier and Type | Class and Description |
---|---|
class |
AbstractTimeFormatHelper<F,S>
An abstract time formatting helper.
|
class |
DateTimeFormatHelper
This is an alternative to
DateTimeFormatResolver . |
class |
LocaleAwareValueHelper
An abstract
Locale -aware helper. |
class |
ResourceBundleHelper
First register the helper instance:
MustacheEngineBuilder.newBuilder().registerHelper("msg", new ResourceBundleHelper("messages")).build();
Than use the helper in the template:
{{msg "my.key"}}
The key need not be a string literal:
{{msg foo.key}}
You may also override the default baseName:
{{msg "my.key" baseName="messages"}}
And also use message parameters and Formatter or
MessageFormat :
hello.key=Hello %s! |
class |
TimeFormatHelper
An alternative to
DateTimeFormatHelper which makes use of java.time
package in JDK 8 (JSR-310). |
Copyright © 2017. All rights reserved.