private void increaseModelLevel(final IOpenElementTag openElementTag) { this.modelLevel++; if (this.skipBodyByLevel.length == this.modelLevel) { this.skipBodyByLevel = Arrays.copyOf(this.skipBodyByLevel, this.skipBodyByLevel.length + DEFAULT_MODEL_LEVELS/2); this.skipCloseTagByLevel = Arrays.copyOf(this.skipCloseTagByLevel, this.skipCloseTagByLevel.length + DEFAULT_MODEL_LEVELS/2); this.unskippedFirstElementByLevel = Arrays.copyOf(this.unskippedFirstElementByLevel, this.unskippedFirstElementByLevel.length + DEFAULT_MODEL_LEVELS/2); } skipBody(this.skipBody.processChildren ? SkipBody.PROCESS : SkipBody.SKIP_ALL); this.skipCloseTagByLevel[this.modelLevel] = false; this.unskippedFirstElementByLevel[this.modelLevel] = null; if (this.context != null) { this.context.increaseLevel(); this.context.setElementTag(openElementTag); } }
static IEngineContext prepareEngineContext( final IEngineConfiguration configuration, final TemplateData templateData, final Map<String, Object> templateResolutionAttributes, final IContext context) { final IEngineContext engineContext = createEngineContextIfNeeded(configuration, templateData, templateResolutionAttributes, context); // We will always do this, even if the context is a new object (in which case it would be completely needed) // because we want to make sure the 'disposeEngineContext' call that will come afterwards can safely // decrease the level engineContext.increaseLevel(); if (context instanceof IEngineContext) { // Set the template resolution into the context, but only if we haven't just created it engineContext.setTemplateData(templateData); } return engineContext; }
boolean shouldProcessStandaloneElement(final IStandaloneElementTag standaloneElementTag) { this.secondToLastEvent = this.lastEvent; this.lastEvent = standaloneElementTag; if (this.gatheredModel != null) { this.gatheredModel.gatherStandaloneElement(standaloneElementTag); return false; } boolean process = this.skipBody.processElements; if (this.skipBody == SkipBody.PROCESS_ONE_ELEMENT) { // This was the first element, the others will be skipped. Let's save it in case it is iterated this.unskippedFirstElementByLevel[this.modelLevel] = standaloneElementTag; skipBody(SkipBody.SKIP_ELEMENTS); process = true; } if (process) { /* * INCREASE THE CONTEXT LEVEL so that all local variables created during the execution of processors * are available for the rest of the processors as well as the body of the tag */ if (this.context != null) { this.context.increaseLevel(); this.context.setElementTag(standaloneElementTag); } } return process; }
this.context.increaseLevel();