Class DefaultTemplateResolver

    • Constructor Detail

      • DefaultTemplateResolver

        public DefaultTemplateResolver()

        Creates a new instance of this template resolver.

    • Method Detail

      • getTemplateMode

        public final TemplateMode getTemplateMode()

        Returns the template mode to be applied to templates resolved by this template resolver.

        Returns:
        the template mode to be used.
      • setTemplateMode

        public final void setTemplateMode(TemplateMode templateMode)

        Sets the template mode to be applied to templates resolved by this resolver.

        Parameters:
        templateMode - the template mode.
      • setTemplateMode

        public final void setTemplateMode(String templateMode)

        Sets the template mode to be applied to templates resolved by this resolver.

        Allowed templates modes are defined by the TemplateMode class.

        Parameters:
        templateMode - the template mode.
      • getTemplate

        public String getTemplate()

        Returns the text that will always be returned by this template resolver as the resolved template.

        Returns:
        the text to be returned as template.
      • setTemplate

        public void setTemplate(String template)

        Set the text that will be returned as the resolved template.

        Parameters:
        template - the text to be returned as template.
      • computeTemplateResource

        protected ITemplateResource computeTemplateResource(IEngineConfiguration configuration,
                                                            String ownerTemplate,
                                                            String template,
                                                            Map<String,Object> templateResolutionAttributes)
        Description copied from class: AbstractTemplateResolver

        Computes the resolved template resource.

        Specified by:
        computeTemplateResource in class AbstractTemplateResolver
        Parameters:
        configuration - the engine configuration.
        ownerTemplate - the owner template, if the resource being computed is a fragment. Might be null.
        template - the template to be resolved (usually its name).
        templateResolutionAttributes - the template resolution attributes, if any. Might be null.
        Returns:
        the template resource, or null if this template cannot be resolved (or the resource does not exist).
      • computeTemplateMode

        protected TemplateMode computeTemplateMode(IEngineConfiguration configuration,
                                                   String ownerTemplate,
                                                   String template,
                                                   Map<String,Object> templateResolutionAttributes)
        Description copied from class: AbstractTemplateResolver

        Computes the template mode that should be applied to a template, according to existing configuration.

        Specified by:
        computeTemplateMode in class AbstractTemplateResolver
        Parameters:
        configuration - the engine configuration.
        ownerTemplate - the owner template, if the resource being computed is a fragment. Might be null.
        template - the template to be resolved (usually its name).
        templateResolutionAttributes - the template resolution attributes, if any. Might be null.
        Returns:
        the template mode proposed by the template resolver for the resolved template.
      • computeValidity

        protected ICacheEntryValidity computeValidity(IEngineConfiguration configuration,
                                                      String ownerTemplate,
                                                      String template,
                                                      Map<String,Object> templateResolutionAttributes)
        Description copied from class: AbstractTemplateResolver

        Computes the validity to be applied to the template resolution. This includes determining whether the template can be cached or not, and also in what circumstances (for instance, for how much time) can its cache entry be considered valid.

        Specified by:
        computeValidity in class AbstractTemplateResolver
        Parameters:
        configuration - the engine configuration.
        ownerTemplate - the owner template, if the resource being computed is a fragment. Might be null.
        template - the template to be resolved (usually its name).
        templateResolutionAttributes - the template resolution attributes, if any. Might be null.
        Returns:
        the validity