org.thymeleaf.templateresolver
Class TemplateResolution

Object
  extended by org.thymeleaf.templateresolver.TemplateResolution

public final class TemplateResolution
extends Object

Result of the execution of a Template Resolver.

A TemplateResolution object is created by implementations of ITemplateResolver when templates are resolved, and it contains:

The fact that a Template Resolver returns a TemplateResolution does not necessarily mean that the template will be effectively be resolved by the Template Resolver. For this, the Resource Resolver will also need to be able to resolve the declared template's resource.

Since:
1.0
Author:
Daniel Fernández

Constructor Summary
TemplateResolution(String templateName, String resourceName, IResourceResolver resourceResolver, String characterEncoding, String templateMode, ITemplateResolutionValidity validity)
           
 
Method Summary
 String getCharacterEncoding()
           Returns the character encoding that should be used for reading the template (using the Resource Resolver).
 String getResourceName()
           Returns the resource name.
 IResourceResolver getResourceResolver()
           Returns the resource resolver that should be used for actually reading the template (using the provided resource name, see getResourceName()).
 String getTemplateMode()
           Returns the template mode to be applied.
 String getTemplateName()
           Returns the template name.
 ITemplateResolutionValidity getValidity()
           Returns the template resolution validity.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateResolution

public TemplateResolution(String templateName,
                          String resourceName,
                          IResourceResolver resourceResolver,
                          String characterEncoding,
                          String templateMode,
                          ITemplateResolutionValidity validity)
Method Detail

getTemplateName

public String getTemplateName()

Returns the template name.

This should be the same name used for calling the TemplateEngine.process(String, org.thymeleaf.context.IContext) method.

Returns:
the template name.

getResourceName

public String getResourceName()

Returns the resource name.

The resource name is the identifier that will be used for actually reading the template by means of the Resource Resolver (see getResourceResolver()).

This resource name will typically be computed by the Template Resolver from the template name. For example, a Template Resolver could have a prefix and a suffix configured so that starting from the template name "home" it returns the resource name "/WEB-INF/templates/web/home.html", which can be then read by a ClassLoaderResourceResolver instance.

Returns:
the resource name.

getResourceResolver

public IResourceResolver getResourceResolver()

Returns the resource resolver that should be used for actually reading the template (using the provided resource name, see getResourceName()).

Returns:
the resource resolver.

getCharacterEncoding

public String getCharacterEncoding()

Returns the character encoding that should be used for reading the template (using the Resource Resolver).

Returns:
the character encoding.

getTemplateMode

public String getTemplateMode()

Returns the template mode to be applied. This template mode should be resolvable to a configured Template Mode Handler (ITemplateModeHandler).

Returns:
the template mode.

getValidity

public ITemplateResolutionValidity getValidity()

Returns the template resolution validity.

This validity establishes whether the template can be included in the template cache, and also for how long its resolution will be considered valid.

When a cached template is not considered valid, its cache entry is discarded and it is resolved again.

Returns:
the validity object


Copyright © 2012 The THYMELEAF team. All Rights Reserved.