private TemplateModel getNodeProcessor(Namespace ns, String localName, String nsURI) throws TemplateException { TemplateModel result = null; if (nsURI == null) { result = ns.get(localName); if (!(result instanceof Macro) && !(result instanceof TemplateTransformModel)) { result = null; result = ns.get(prefix + ":" + localName); if (!(result instanceof Macro) && !(result instanceof TemplateTransformModel)) { result = null; result = ns.get(Template.NO_NS_PREFIX + ":" + localName); if (!(result instanceof Macro) && !(result instanceof TemplateTransformModel)) { result = null; result = ns.get(Template.DEFAULT_NAMESPACE_PREFIX + ":" + localName); if (!(result instanceof Macro) && !(result instanceof TemplateTransformModel)) { result = null; result = ns.get(localName); if (!(result instanceof Macro) && !(result instanceof TemplateTransformModel)) { result = null;
case PAGE_SCOPE: { try { final TemplateModel tm = environment.getGlobalNamespace().get(name); if (incompatibleImprovements >= _TemplateAPI.VERSION_INT_2_3_22 && unwrapper != null) { return unwrapper.unwrap(tm);
for (int i = 0; i < paramNames.length; ++i) { String argName = paramNames[i]; if (localVars.get(argName) == null) { Expression valueExp = (Expression) paramDefaults.get(argName); if (valueExp != null) {
/** * @return the local variable of the given name * or null if it doesn't exist. */ public TemplateModel getLocalVariable(String name) throws TemplateModelException { return localVars.get(name); }
@Override public TemplateModel get(String key) throws TemplateModelException { ensureInitializedTME(); return super.get(key); }
public TemplateModel get(String key) throws TemplateModelException { TemplateModel result = globalNamespace.get(key); if (result == null) { result = rootDataModel.get(key); } if (result == null) { result = configuration.getSharedVariable(key); } return result; } };
@Override public TemplateModel get(String key) throws TemplateModelException { ensureInitializedTME(); return super.get(key); }
public TemplateModel get(String key) throws TemplateModelException { TemplateModel result = globalNamespace.get(key); if (result == null) { result = rootDataModel.get(key); } if (result == null) { result = getConfiguration().getSharedVariable(key); } return result; } };
public TemplateModel get(String key) throws TemplateModelException { TemplateModel result = globalNamespace.get(key); if (result == null) { result = rootDataModel.get(key); } if (result == null) { result = configuration.getSharedVariable(key); } return result; } };
/** * @return the local variable of the given name * or null if it doesn't exist. */ public TemplateModel getLocalVariable(String name) throws TemplateModelException { return localVars.get(name); }
/** * @return the local variable of the given name * or null if it doesn't exist. */ public TemplateModel getLocalVariable(String name) throws TemplateModelException { return localVars.get(name); }
private Map<String, TemplateModel> reduce() throws TemplateModelException { Map<String, TemplateModel> reduceMap = new LinkedHashMap<>(); ObjectWrapper objectWrapper = environment.getObjectWrapper(); Namespace namespace = environment.getCurrentNamespace(); Iterator<Entry<String, Object>> iterator = map.entrySet().iterator(); for (int i = 0; iterator.hasNext(); i++) { Entry<String, Object> entry = iterator.next(); if (i < loopVars.length) { loopVars[i] = objectWrapper.wrap(entry.getValue()); } else { String key = entry.getKey(); reduceMap.put(key, namespace.get(key)); namespace.put(key, objectWrapper.wrap(entry.getValue())); } } return reduceMap; }
private Map<String, TemplateModel> reduce() throws TemplateModelException { Map<String, TemplateModel> reduceMap = new LinkedHashMap<>(); ObjectWrapper objectWrapper = environment.getObjectWrapper(); Namespace namespace = environment.getCurrentNamespace(); Iterator<Entry<String, Object>> iterator = map.entrySet().iterator(); for (int i = 0; iterator.hasNext(); i++) { Entry<String, Object> entry = iterator.next(); if (i < loopVars.length) { loopVars[i] = objectWrapper.wrap(entry.getValue()); } else { String key = entry.getKey(); reduceMap.put(key, namespace.get(key)); namespace.put(key, objectWrapper.wrap(entry.getValue())); } } return reduceMap; }
lhoValue = env.getLocalVariable(variableName); } else { lhoValue = namespace.get(variableName);
/** * Returns the variable that is visible in this context, or {@code null} if the variable is not found. This is the * correspondent to an FTL top-level variable reading expression. That is, it tries to find the the variable in this * order: * <ol> * <li>An loop variable (if we're in a loop or user defined directive body) such as foo_has_next * <li>A local variable (if we're in a macro) * <li>A variable defined in the current namespace (say, via <#assign ...>) * <li>A variable defined globally (say, via <#global ....>) * <li>Variable in the data model: * <ol> * <li>A variable in the root hash that was exposed to this rendering environment in the Template.process(...) call * <li>A shared variable set in the configuration via a call to Configuration.setSharedVariable(...) * </ol> * </li> * </ol> */ public TemplateModel getVariable(String name) throws TemplateModelException { TemplateModel result = getLocalVariable(name); if (result == null) { result = currentNamespace.get(name); } if (result == null) { result = getGlobalVariable(name); } return result; }
public TemplateModel getLocalVariable(String name) throws TemplateModelException { return bodyVars == null ? null : bodyVars.get(name); }
/** * Returns the globally visible variable of the given name (or null). This is correspondent to FTL * <code>.globals.<i>name</i></code>. This will first look at variables that were assigned globally via: <#global * ...> and then at the data model exposed to the template. */ public TemplateModel getGlobalVariable(String name) throws TemplateModelException { TemplateModel result = globalNamespace.get(name); if (result == null) { result = rootDataModel.get(name); } if (result == null) { result = configuration.getSharedVariable(name); } return result; }
@Override public TemplateModel get(String key) throws TemplateModelException { ensureInitializedTME(); return super.get(key); }
/** * @return the local variable of the given name * or null if it doesn't exist. */ public TemplateModel getLocalVariable(String name) throws TemplateModelException { return localVars.get(name); }
public TemplateModel get(String key) throws TemplateModelException { TemplateModel result = globalNamespace.get(key); if (result == null) { result = rootDataModel.get(key); } if (result == null) { result = configuration.getSharedVariable(key); } return result; } };