public class EvalHelper extends BasicHelper
First a key is built from the params, or rather their
Object.toString() representations, by default dot notation is used.
Then we attempt to find the value from the context. If the helper represents
a section and the value is not null the value is pushed on the context stack
and the section is rendered. If the helper represents a variable and the
value is null, the current MissingValueHandler is used. If the helper
represents a variable and the final value is not null the the value's
Object.toString() is rendered.
{{eval "foo" "bar"}}
is equivalent to:
{{foo.bar}}
On the other hand:
{{#eval "list" idx}}
Element name: {{name}}
{{/eval}}
is equivalent to (provided the idx evaluates to 1):
{{#with list.1}}
Element name: {{name}}
{{/with}}
EvalHelper.Notation,
KeySplitter| Modifier and Type | Class and Description |
|---|---|
static class |
EvalHelper.BracketDotNotation |
static class |
EvalHelper.DotNotation |
static interface |
EvalHelper.Notation |
HELPER_TAG_TYPES, NO_SUPPORTED_HASH_KEYSconfiguration| Constructor and Description |
|---|
EvalHelper() |
EvalHelper(EvalHelper.Notation notation) |
| Modifier and Type | Method and Description |
|---|---|
void |
execute(Options options)
Execute the helper.
|
protected com.google.common.base.Optional<Set<String>> |
getSupportedHashKeys() |
allowedTagTypes, numberOfRequiredHashEntries, numberOfRequiredParameters, validateappend, getHashValue, init, isSection, isUnescapeVariable, isVariablegetConfigurationKeys, checkNotInitialized, initclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetConfigurationKeys, initpublic EvalHelper()
public EvalHelper(EvalHelper.Notation notation)
public void execute(Options options)
Helperprotected com.google.common.base.Optional<Set<String>> getSupportedHashKeys()
getSupportedHashKeys in class BasicHelperCopyright © 2015. All rights reserved.