Context(Environment env, TemplateObject callPlace, List nestedContentParameterNames) { this.localVars = env.new Namespace(); this.callPlace = callPlace; this.nestedContentNamespace = env.getCurrentNamespace(); this.nestedContentParameterNames = nestedContentParameterNames; this.prevLocalContextStack = env.getLocalContextStack(); this.prevMacroContext = env.getCurrentMacroContext(); }
/** * @param loopVariableName * Then name of the loop variable whose context we are looking for, or {@code null} if we simply look for * the innermost context. * @return The matching context or {@code null} if no such context exists. */ static IterationContext findEnclosingIterationContext(Environment env, String loopVariableName) throws _MiscTemplateException { LocalContextStack ctxStack = env.getLocalContextStack(); if (ctxStack != null) { for (int i = ctxStack.size() - 1; i >= 0; i--) { Object ctx = ctxStack.get(i); if (ctx instanceof IterationContext && (loopVariableName == null || loopVariableName.equals(((IterationContext) ctx).getLoopVariableName()) || loopVariableName.equals(((IterationContext) ctx).getLoopVariable2Name()) )) { return (IterationContext) ctx; } } } return null; }
Context(Environment env, TemplateObject callPlace, List nestedContentParameterNames) { this.localVars = env.new Namespace(); this.callPlace = callPlace; this.nestedContentNamespace = env.getCurrentNamespace(); this.nestedContentParameterNames = nestedContentParameterNames; this.prevLocalContextStack = env.getLocalContextStack(); this.prevMacroContext = env.getCurrentMacroContext(); }
Context(Environment env, TemplateObject callPlace, List nestedContentParameterNames) { this.localVars = env.new Namespace(); this.callPlace = callPlace; this.nestedContentNamespace = env.getCurrentNamespace(); this.nestedContentParameterNames = nestedContentParameterNames; this.prevLocalContextStack = env.getLocalContextStack(); this.prevMacroContext = env.getCurrentMacroContext(); }
Context(Environment env, TemplateElement body, List bodyParameterNames) { this.localVars = env.new Namespace(); this.prevMacroContext = env.getCurrentMacroContext(); this.bodyNamespace = env.getCurrentNamespace(); this.prevLocalContextStack = env.getLocalContextStack(); this.body = body; this.bodyParameterNames = bodyParameterNames; }
/** * @param loopVariableName * Then name of the loop variable whose context we are looking for, or {@code null} if we simply look for * the innermost context. * @return The matching context or {@code null} if no such context exists. */ static IterationContext findEnclosingIterationContext(Environment env, String loopVariableName) throws _MiscTemplateException { LocalContextStack ctxStack = env.getLocalContextStack(); if (ctxStack != null) { for (int i = ctxStack.size() - 1; i >= 0; i--) { Object ctx = ctxStack.get(i); if (ctx instanceof IterationContext && (loopVariableName == null || loopVariableName.equals(((IterationContext) ctx).getLoopVariableName()) || loopVariableName.equals(((IterationContext) ctx).getLoopVariable2Name()) )) { return (IterationContext) ctx; } } } return null; }
/** * @param loopVariableName * Then name of the loop variable whose context we are looking for, or {@code null} if we simply look for * the innermost context. * @return The matching context or {@code null} if no such context exists. */ static IterationContext findEnclosingIterationContext(Environment env, String loopVariableName) throws _MiscTemplateException { LocalContextStack ctxStack = env.getLocalContextStack(); if (ctxStack != null) { for (int i = ctxStack.size() - 1; i >= 0; i--) { Object ctx = ctxStack.get(i); if (ctx instanceof IterationContext && (loopVariableName == null || loopVariableName.equals(((IterationContext) ctx).getLoopVariableName()) || loopVariableName.equals(((IterationContext) ctx).getLoopVariable2Name()) )) { return (IterationContext) ctx; } } } return null; }