public class ChooseHelper extends BasicSectionHelper
At the moment it's not possible to validate the helper content properly. However, it should only contain when and otherwise sections. Other types of segments are always rendered.
Since we push the flow object on the context stack, it's possible to refer
the last context object with Nested.up() method. See also examples.
{{#choose}}
{{#when this.up}}
Hello active!
{{/when}}
{{#when foo}}
Hello foo!
{{/when}}
{{#otherwise}}
No match.
{{/otherwise}}
{{/switch}}
will render "Hello active!" if last context object (i.e. "this" before we enter
the choose helper) is not falsy. "Hello foo" if "this.up" is falsy and "foo"
is not falsy. And "No match." if both "this.up" and "foo" are falsy.| Modifier and Type | Class and Description |
|---|---|
static class |
ChooseHelper.OtherwiseHelper |
static class |
ChooseHelper.WhenHelper
The first param is the test condition.
|
SECTION_TYPESHELPER_TAG_TYPES| Constructor and Description |
|---|
ChooseHelper() |
| Modifier and Type | Method and Description |
|---|---|
void |
execute(Options options)
Execute the helper.
|
protected int |
numberOfRequiredParameters() |
allowedTagTypesnumberOfRequiredHashEntries, validateappend, getHashValue, init, isSection, isUnescapeVariable, isVariablegetConfigurationKeys, checkNotInitializedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetConfigurationKeysprotected int numberOfRequiredParameters()
numberOfRequiredParameters in class BasicHelperCopyright © 2014. All Rights Reserved.