/** * <p> * Returns the <em>template stack</em>, containing the metadata for the first-level template being * processed and also any fragments that might have been nested up to the current execution point. * </p> * <p> * The result of this method actually corresponds to the result of {@link ITemplateContext#getTemplateStack()}. * </p> * * @return the stack of {@link TemplateData} objects */ public List<TemplateData> getTemplateStack() { return this.context.getTemplateStack(); }
/** * <p> * Returns the template mode ({@link TemplateMode}) of the first-level template. * </p> * <p> * Note this template mode refers to the first-level one, the one used to call the TemplateEngine itself, even * if by the moment this method is called the engine is processing a fragment inserted from the first-level * template (or at any other level in the hierarchy). * </p> * * @return the template mode */ public TemplateMode getProcessedTemplateMode() { return this.context.getTemplateStack().get(0).getTemplateMode(); }
/** * <p> * Returns the template name of the first-level template. * </p> * <p> * Note this template name refers to the first-level one, the one used to call the TemplateEngine itself, even * if by the moment this method is called the engine is processing a fragment inserted from the first-level * template (or at any other level in the hierarchy). * </p> * * @return the template name */ public String getProcessedTemplateName() { return this.context.getTemplateStack().get(0).getTemplate(); }
/** * <p> * Returns the names of all the stack of templates appliable to the current point * of execution. This will depend on which templates are inserted inside wich. * </p> * <p> * The first-level template will appear first, and the most specific template will appear last. * </p> * * @return the stack of template names */ public List<String> getTemplateNames() { final List<TemplateData> templateStack = this.context.getTemplateStack(); final List<String> templateNameStack = new ArrayList<String>(templateStack.size()); for (final TemplateData templateData : templateStack) { templateNameStack.add(templateData.getTemplate()); } return templateNameStack; }
/** * <p> * Returns the {@link TemplateMode}s of all the stack of templates appliable to the current point * of execution. This will depend on which templates are inserted inside wich. * </p> * <p> * The first-level template will appear first, and the most specific template will appear last. * </p> * * @return the stack of template modes */ public List<TemplateMode> getTemplateModes() { final List<TemplateData> templateStack = this.context.getTemplateStack(); final List<TemplateMode> templateModeStack = new ArrayList<TemplateMode>(templateStack.size()); for (final TemplateData templateData : templateStack) { templateModeStack.add(templateData.getTemplateMode()); } return templateModeStack; }
for (final TemplateData templateData : context.getTemplateStack()) {
for (int i = context.getTemplateStack().size() - 1; i >= 0; i--) { templateNameStack.add(context.getTemplateStack().get(i).getTemplate());