org.thymeleaf
Class TemplateRepository

Object
  extended by org.thymeleaf.TemplateRepository

public final class TemplateRepository
extends Object

The template repository is an internal utility class that is responsible before the Template Engine of retrieving templates (parsed) and fragments, performing all the necessary operations against the caches in order to obtain the required data.

Each TemplateEngine uses a single object of this class.

Since:
2.0.0
Author:
Daniel Fernández

Method Summary
 void clearFragmentCache()
           Clears the fragments cache.
 void clearFragmentCacheFor(String fragment)
           Clears a specific entry at the fragment cache.
 void clearTemplateCache()
           Clears the template cache.
 void clearTemplateCacheFor(String templateName)
           Clears any existing entries for template of the specified name at the template cache.
 java.util.List<Node> getFragment(Arguments arguments, String fragment)
           Obtains a fragment.
 Template getTemplate(TemplateProcessingParameters templateProcessingParameters)
           Obtains a template.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

clearTemplateCache

public void clearTemplateCache()

Clears the template cache.


clearTemplateCacheFor

public void clearTemplateCacheFor(String templateName)

Clears any existing entries for template of the specified name at the template cache.

Parameters:
templateName - the name of the template whose entries have to be cleared.

clearFragmentCache

public void clearFragmentCache()

Clears the fragments cache.


clearFragmentCacheFor

public void clearFragmentCacheFor(String fragment)

Clears a specific entry at the fragment cache.

Parameters:
fragment - the fragment to be cleared.

getTemplate

public Template getTemplate(TemplateProcessingParameters templateProcessingParameters)

Obtains a template. This method is responsible of providing a Template to the TemplateEngine by following these steps:

Parameters:
templateProcessingParameters - the parameters object containing all the necessary pieces of data in order to adequately resolve the template.
Returns:
the resolved and parsed Template.

getFragment

public java.util.List<Node> getFragment(Arguments arguments,
                                        String fragment)

Obtains a fragment. A fragment is a piece of template code that is usually read from a different source and needs parsing for converting it into a DOM subtree.

Common examples of fragments are the messages in a Messages.properties file that contain tags like <strong> <u>, etc. and are included in thymeleaf templates via an attribute like th:utext.

Parameters:
arguments - the execution arguments
fragment - the fragment to be processed
Returns:
the result of processing the fragment: a list of Node that can be linked to the DOM being processed.


Copyright © 2012 The THYMELEAF team. All Rights Reserved.