Class TemplateProcessor

    • Field Detail

      • templateNodeScanner

        protected NodeScanner templateNodeScanner
        NodeScanner for template nodes.
      • templateCompiler

        protected TemplateCompiler<IdentifiableStringTemplateSource> templateCompiler
        Template compiler. It basically compiles the template provided in an element and then processes it by using a model obtained through the modelFactory.
    • Constructor Detail

      • TemplateProcessor

        public TemplateProcessor()
    • Method Detail

      • setTemplateNodeScanner

        public void setTemplateNodeScanner​(NodeScanner templateNodeScanner)
        Sets the NodeScanner for template nodes.
      • setTemplateCompiler

        public void setTemplateCompiler​(TemplateCompiler<IdentifiableStringTemplateSource> templateCompiler)
        Sets the template compiler. It basically compiles the template provided in an element and then processes it by using a model obtained through the modelFactory.
      • setModelFactory

        public void setModelFactory​(NodeTemplateModelFactory modelFactory)
        Sets the factory that provides the models for the templates.
      • process

        public Item process​(Context context,
                            CachingOptions cachingOptions,
                            Item item)
                     throws ItemProcessingException
        Processes the content of certain nodes (found by the NodeScanner in the item's descriptor as templates, by compiling the node text templates through the templateCompiler and then processing the compiled template with a model returned by modelFactory.
        Specified by:
        process in interface ItemProcessor
        Parameters:
        context - the current context
        cachingOptions - caching options in case you need access to items
        item - the item to process
        Returns:
        the modified item or a new item.
        Throws:
        ItemProcessingException - if an error occurred while processing a template
      • equals

        public boolean equals​(Object o)
        Returns true if the specified TemplateProcessor's and this instance's fields are equal.
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Returns the hash code for this instance, which is basically the combination of the hash code of each field. As with any other ItemProcessor, this method is defined because any processor which is passed in the method call of a ContentStoreService can be used as part of a key for caching.
        Overrides:
        hashCode in class Object