public class DefaultModelAdaptor extends Object implements ModelAdaptor
Does the object traversal using the "." operator. Resolved value will be
checked if it is either a Processor or a Callable in which
case the final resolved value is computed by calling those executable
objects.
Inherit from this adapter if you want a slight change of this behavior and
set your new adaptor on the engine
Engine.setModelAdaptor(ModelAdaptor) .
| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultModelAdaptor.LoopMode |
| Constructor and Description |
|---|
DefaultModelAdaptor() |
DefaultModelAdaptor(DefaultModelAdaptor.LoopMode loopMode) |
DefaultModelAdaptor(DefaultModelAdaptor.LoopMode loopMode,
String specialIteratorVariable,
boolean enableSlowMapAccess) |
| Modifier and Type | Method and Description |
|---|---|
Iterable<Object> |
getIterable(Object value)
Gets an iterable for an arbitrary value.
|
String |
getSpecialIteratorVariable()
Gets the name of the special iterator variable which will be used as an alternative
variable name of the iterator in a foreach loop.
|
Object |
getValue(Map<String,Object> model,
String expression) |
Object |
getValue(TemplateContext context,
Token token,
List<String> segments,
String expression)
Gets a value from the model.
|
public DefaultModelAdaptor()
public DefaultModelAdaptor(DefaultModelAdaptor.LoopMode loopMode)
public DefaultModelAdaptor(DefaultModelAdaptor.LoopMode loopMode, String specialIteratorVariable, boolean enableSlowMapAccess)
public Object getValue(TemplateContext context, Token token, List<String> segments, String expression)
ModelAdaptorgetValue in interface ModelAdaptorcontext - the current context including the scoped modeltoken - the token that asks for this value (e.g. used for error
reporting)segments - an already split version of the expression for faster
processingexpression - the expression describing the desired valuepublic Iterable<Object> getIterable(Object value)
ModelAdaptorgetIterable in interface ModelAdaptorvalue - the value to get the iterable forpublic String getSpecialIteratorVariable()
ModelAdaptorgetSpecialIteratorVariable in interface ModelAdaptorCopyright © 2017. All rights reserved.