public class EachHelper extends BasicSectionHelper
{{#each items}}
{{name}}
{{/each}}
It's possible to apply a function to each element. The function must be an
instance of Function. Note that the function cannot be type-safe. If
the result does not equal to SKIP_RESULT it's used instead
of the original element. If the result equals to
SKIP_RESULT the element is skipped. This might be useful
to filter out unnecessary elements or to wrap/transform elements.
{{#each items apply=myFunction}}
{{name}}
{{/each}}
It's also possible to supply an alias to access the value of the current iteration:
{{#each items as='item'}}
{{item.name}}
{{/each}}
Function| Modifier and Type | Field and Description |
|---|---|
static String |
SKIP_RESULT |
SECTION_TYPESHELPER_TAG_TYPES, NO_SUPPORTED_HASH_KEYSconfiguration| Constructor and Description |
|---|
EachHelper() |
| Modifier and Type | Method and Description |
|---|---|
void |
execute(Options options)
Execute the helper.
|
protected com.google.common.base.Optional<Set<String>> |
getSupportedHashKeys() |
void |
init()
Can be overridden so that there's no need to call
super.init(Configuration). |
allowedTagTypesnumberOfRequiredHashEntries, numberOfRequiredParameters, validateappend, getHashValue, isSection, isUnescapeVariable, isVariablegetConfigurationKeys, checkNotInitialized, initclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetConfigurationKeys, initpublic static final String SKIP_RESULT
public void init()
AbstractConfigurationAwaresuper.init(Configuration).init in class AbstractHelperpublic void execute(Options options)
Helperprotected com.google.common.base.Optional<Set<String>> getSupportedHashKeys()
getSupportedHashKeys in class BasicHelperCopyright © 2015. All rights reserved.