protected AbstractStandardInliner( final IEngineConfiguration configuration, final TemplateMode templateMode) { super(); Validate.notNull(configuration, "Engine configuration cannot be null"); Validate.notNull(templateMode, "Template Mode cannot be null"); this.templateMode = templateMode; /* * The 'writeTextsToOutput' flag will mean that the inliner can directly use the output Writer when * processing inlined IText's, instead of creating a separate StringWriter object (and therefore a * String containing the whole result of processing the inlined text). This should result in a * performance optimization when inlining is very used, but can only be done if the following * happens: * * - There are no post-processors that might want to do things on the processed text result. * - There are no other ITextProcessor instances declared other than the * corresponding StandardInlinerTextProcessor. * * In that case, the inliner will return a LazyProcessingCharSequence object, which will perform the * direct writer output. But the conditions above are needed to ensure that the context is not going to * be modified from the moment this inliner executes to the moment the output is written. * * Note: we are checking for the size of textprocessors but not checking if that one (at most) processor is * actually the inline processor. And that fine because, if it isn't, then nobody will be applying * inlining to text nodes in the first place, and this inliner will never be executed. */ final Set<IPostProcessor> postProcessors = configuration.getPostProcessors(this.templateMode); final Set<ITextProcessor> textProcessors = configuration.getTextProcessors(this.templateMode); this.writeTextsToOutput = postProcessors.isEmpty() && textProcessors.size() <= 1; }
final Set<IDocTypeProcessor> docTypeProcessorSet = this.configuration.getDocTypeProcessors(this.templateMode); final Set<IProcessingInstructionProcessor> processingInstructionProcessorSet = this.configuration.getProcessingInstructionProcessors(this.templateMode); final Set<ITextProcessor> textProcessorSet = this.configuration.getTextProcessors(this.templateMode); final Set<IXMLDeclarationProcessor> xmlDeclarationProcessorSet = this.configuration.getXMLDeclarationProcessors(this.templateMode);