/** * <p> * Adds a set of variables to the current set of context variables. * </p> * * @param additionalVariables the new variables to be added. */ public final void setVariables(final Map<String,?> additionalVariables) { Validate.notNull(additionalVariables, "Variables map cannot be null"); this.variables.putAll(additionalVariables); }
private Object createEvaluationRoot() { final VariablesMap<String, Object> contextVariables = this.context.getVariables(); // We create a new VariablesMap instance using its constructor instead of cloning the existing one // because we want to avoid undesirable interactions like, for example, those that could happen // if we executed putAll on a WebVariablesMap object (which would add those variables to the HttpServletRequest // and therefore make them available to the whole page and not just the local variable scope). final VariablesMap<String,Object> newEvaluationRoot = new VariablesMap<String, Object>(contextVariables); if (this.localVariables != null) { newEvaluationRoot.putAll(this.localVariables); } return newEvaluationRoot; }
/** * <p> * Create an instance specifying a locale and an initial set of context * variables. * </p> * * @param locale the locale to be used. * @param variables the initial set of context variables. */ AbstractContext(final Locale locale, final Map<String, ?> variables) { super(); Validate.notNull(locale, "Locale cannot be null"); this.locale = locale; final VariablesMap<String,Object> newVariablesMap; if (variables != null) { newVariablesMap = new VariablesMap<String,Object>((variables.size()*3)/2, 1.0f); newVariablesMap.putAll(variables); } else { newVariablesMap = new VariablesMap<String,Object>(5); } this.variables = newVariablesMap; }
public ThymeleafCall template(final String name) { final IContext ctx = makeContext(); // Expose the service configuration ctx.getVariables().put("config", configuration); ctx.getVariables().putAll(data); return new ThymeleafCall(engine, ctx, name, calls, failures); }
public ThymeleafCall template(final String name) { final IContext ctx = makeContext(); // Expose the service configuration ctx.getVariables().put("config", configuration); ctx.getVariables().putAll(data); return new ThymeleafCall(engine, ctx, name, calls, failures); }