org.thymeleaf.fragment
Class FragmentAndTarget

Object
  extended by org.thymeleaf.fragment.FragmentAndTarget

public final class FragmentAndTarget
extends Object

Container class for a pair of template name + fragment spec, capable of executing the fragment spec on the specified template, after obtaining the template from TemplateRepository.

Since:
2.0.9
Author:
Daniel Fernández

Constructor Summary
FragmentAndTarget(String templateName, IFragmentSpec fragmentSpec)
           Create a new instance of this class.
 
Method Summary
 List<Node> extractFragment(Configuration configuration, IContext context, TemplateRepository templateRepository)
           Read the specified template from TemplateRepository, and then apply the IFragmentSpec to the result of parsing it (the template).
 List<Node> extractFragment(Configuration configuration, IProcessingContext context, TemplateRepository templateRepository)
           Read the specified template from TemplateRepository, and then apply the IFragmentSpec to the result of parsing it (the template).
 IFragmentSpec getFragmentSpec()
           Returns the IFragmentSpec that will be applied to the template.
 String getTemplateName()
           Returns the name of the template that will be resolved and parsed.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FragmentAndTarget

public FragmentAndTarget(String templateName,
                         IFragmentSpec fragmentSpec)

Create a new instance of this class.

Parameters:
templateName - the name of the template that will be resolved and parsed.
fragmentSpec - the fragment spec that will be applied to the template, once parsed.
Method Detail

getTemplateName

public String getTemplateName()

Returns the name of the template that will be resolved and parsed.

Returns:
the template name.

getFragmentSpec

public IFragmentSpec getFragmentSpec()

Returns the IFragmentSpec that will be applied to the template.

Returns:
the fragment spec.

extractFragment

public final List<Node> extractFragment(Configuration configuration,
                                        IContext context,
                                        TemplateRepository templateRepository)

Read the specified template from TemplateRepository, and then apply the IFragmentSpec to the result of parsing it (the template).

If an IProcessingContext instance is available, using extractFragment(Configuration, IProcessingContext, TemplateRepository) should be preferred to using this method. If this one is used, the specified IContext object will be converted into a DialectAwareProcessingContext instance.

Parameters:
configuration - the configuration to be used for resolving the template and processing the fragment spec.
context - the context to be used for resolving and parsing the template ( after being converted to an IProcessingContext implementation.
templateRepository - the template repository to be asked for the template.
Returns:
the result of parsing + applying the fragment spec.

extractFragment

public final List<Node> extractFragment(Configuration configuration,
                                        IProcessingContext context,
                                        TemplateRepository templateRepository)

Read the specified template from TemplateRepository, and then apply the IFragmentSpec to the result of parsing it (the template).

Parameters:
configuration - the configuration to be used for resolving the template and processing the fragment spec.
context - the processing context to be used for resolving and parsing the template.
templateRepository - the template repository to be asked for the template.
Returns:
the result of parsing + applying the fragment spec.


Copyright © 2013 The THYMELEAF team. All Rights Reserved.