org.thymeleaf
Class Arguments

Object
  extended by org.thymeleaf.context.AbstractProcessingContext
      extended by org.thymeleaf.context.AbstractDialectAwareProcessingContext
          extended by org.thymeleaf.Arguments
All Implemented Interfaces:
IProcessingContext

public final class Arguments
extends AbstractDialectAwareProcessingContext

Objects of this class contain all the required arguments for template processing.

These objects are created internally by the Template Engine in order to provide processors with all the information they might need for performing their tasks.

Arguments include many attributes, among which some should be used internally only, and never by developers of attribute/element processors. Public attributes are:

Since:
1.0
Author:
Daniel Fernández

Field Summary
static String SELECTION_TARGET_LOCAL_VARIABLE_NAME
          Deprecated. Use instead..
 
Fields inherited from class org.thymeleaf.context.AbstractProcessingContext
EVAL_SELECTION_TARGET_LOCAL_VARIABLE_NAME
 
Constructor Summary
Arguments(TemplateEngine templateEngine, TemplateProcessingParameters templateProcessingParameters, TemplateResolution templateResolution, TemplateRepository templateRepository, Document document)
           Create a new Arguments instance.
Arguments(TemplateProcessingParameters templateProcessingParameters, TemplateResolution templateResolution, TemplateRepository templateRepository, Document document)
          Deprecated. Will be removed in 2.1. Use the constructor with a TemplateEngine argument instead.
 
Method Summary
 Arguments addLocalVariables(Map<String,Object> newVariables)
           Creates a new Arguments object by adding some new local variables to the existing map (the rest of the attributes are copied verbatim).
 Arguments addLocalVariablesAndProcessCommentNodes(Map<String,Object> newVariables, boolean shouldProcessCommentNodes)
           Creates a new Arguments object by setting new local variables and a new value for the processCommentNodes flag.
 Arguments addLocalVariablesAndProcessOnlyElementNodes(Map<String,Object> newVariables, boolean shouldProcessOnlyElementNodes)
          Deprecated. Will be removed in 2.1.x. Use the variants for the new flags instead: setProcessTextNodes(boolean), setProcessCommentNodes(boolean) or setProcessTextAndCommentNodes(boolean, boolean).
 Arguments addLocalVariablesAndProcessTextAndCommentNodes(Map<String,Object> newVariables, boolean shouldProcessTextNodes, boolean shouldProcessCommentNodes)
           Creates a new Arguments object by setting new local variables and new values for the processTextNodes and processCommentNodes flags.
 Arguments addLocalVariablesAndProcessTextNodes(Map<String,Object> newVariables, boolean shouldProcessTextNodes)
           Creates a new Arguments object by setting new local variables and a new value for the processTextNodes flag.
 Arguments addLocalVariablesAndSelectionTarget(Map<String,Object> newVariables, Object selectionTarget)
           Creates a new Arguments object by adding some new local variables and setting a selection target.
 Integer getAndIncrementIDSeq(String id)
           Returns a new index (ID count) for a specific value of the id attribute, and increments the count.
 Configuration getConfiguration()
           Returns the Template Engine configuration being used for processing templates.
 Document getDocument()
           Returns the parsed Document DOM object.
 Object getExecutionAttribute(String attributeName)
           Returns the execution attribute with the specified name.
 Map<String,Object> getExecutionAttributes()
           Returns the execution attributes.
 Map<String,Integer> getIdCounts()
           Returns the map of ID counts.
 Integer getNextIDSeq(String id)
           Returns the index (ID count) for a specific value of the id attribute without incrementing the count.
 Integer getPreviousIDSeq(String id)
           Returns the last index (ID count) returned for a specific value of the id attribute (without incrementing the count).
 boolean getProcessCommentNodes()
           Returns whether Comment nodes will be processed.
 boolean getProcessOnlyElementNodes()
          Deprecated. To be removed in 2.1.x. This flag has been substituted by two flags available at the getProcessTextNodes() and getProcessCommentNodes() getter methods.
 boolean getProcessTextNodes()
           Returns whether text nodes (which include Text and CDATASection nodes) will be processed.
 TemplateEngine getTemplateEngine()
           Returns the Template Engine associated to this Arguments instance.
 String getTemplateName()
           Returns the name of the template currently being processed.
 TemplateProcessingParameters getTemplateProcessingParameters()
           Returns the Template Processing Parameters used for resolving and parsing the template being processed.
 TemplateRepository getTemplateRepository()
           Returns the template repository in use.
 TemplateResolution getTemplateResolution()
           Returns the template resolution object corresponding to the template currently being processed.
 Arguments setProcessCommentNodes(boolean shouldProcessCommentNodes)
           Creates a new Arguments object by setting a new value for the processCommentNodes flag.
 Arguments setProcessOnlyElementNodes(boolean shouldProcessOnlyElementNodes)
          Deprecated. Will be removed in 2.1.x. Use the variants for the new flags instead: setProcessTextNodes(boolean), setProcessCommentNodes(boolean) or setProcessTextAndCommentNodes(boolean, boolean).
 Arguments setProcessTextAndCommentNodes(boolean shouldProcessTextNodes, boolean shouldProcessCommentNodes)
           Creates a new Arguments object by setting new values for the processTextNodes and processCommentNodes flags.
 Arguments setProcessTextNodes(boolean shouldProcessTextNodes)
           Creates a new Arguments object by setting a new value for the processTextNodes flag.
 Arguments setSelectionTarget(Object newSelectionTarget)
           Creates a new Arguments object by setting a new selection target.
 
Methods inherited from class org.thymeleaf.context.AbstractDialectAwareProcessingContext
computeExpressionObjects, getExpressionEnhancingDialects
 
Methods inherited from class org.thymeleaf.context.AbstractProcessingContext
getBaseContextVariables, getContext, getExpressionEvaluationRoot, getExpressionObjects, getExpressionSelectionEvaluationRoot, getLocalVariable, getLocalVariables, getSelectionTarget, hasLocalVariable, hasLocalVariables, hasSelectionTarget, mergeNewLocalVariables, unsafeGetLocalVariables
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SELECTION_TARGET_LOCAL_VARIABLE_NAME

@Deprecated
public static final String SELECTION_TARGET_LOCAL_VARIABLE_NAME
Deprecated. Use instead..
See Also:
Constant Field Values
Constructor Detail

Arguments

@Deprecated
public Arguments(TemplateProcessingParameters templateProcessingParameters,
                            TemplateResolution templateResolution,
                            TemplateRepository templateRepository,
                            Document document)
Deprecated. Will be removed in 2.1. Use the constructor with a TemplateEngine argument instead.

Deprecated constructor. Should not use.

Parameters:
templateProcessingParameters -
templateResolution -
templateRepository -
document -

Arguments

public Arguments(TemplateEngine templateEngine,
                 TemplateProcessingParameters templateProcessingParameters,
                 TemplateResolution templateResolution,
                 TemplateRepository templateRepository,
                 Document document)

Create a new Arguments instance.

Mainly for internal use. Should not be called directly except for testing purposes or when processing a template (e.g. a fragment) using the TemplateEngine from a element/attribute processor.

Parameters:
templateProcessingParameters - the template processing parameters.
templateResolution - the template resolution object.
templateRepository - the template repository in use.
document - the parsed document.
Method Detail

getTemplateEngine

public TemplateEngine getTemplateEngine()

Returns the Template Engine associated to this Arguments instance.

Returns:
the template processing parameters
Since:
2.0.14

getTemplateProcessingParameters

public TemplateProcessingParameters getTemplateProcessingParameters()

Returns the Template Processing Parameters used for resolving and parsing the template being processed.

Returns:
the template processing parameters

getConfiguration

public Configuration getConfiguration()

Returns the Template Engine configuration being used for processing templates.

Returns:
the configuration

getTemplateResolution

public TemplateResolution getTemplateResolution()

Returns the template resolution object corresponding to the template currently being processed.

Returns:
the Template Resolution object

getTemplateRepository

public TemplateRepository getTemplateRepository()

Returns the template repository in use.

Returns:
the Template Repository object

getDocument

public Document getDocument()

Returns the parsed Document DOM object.

Returns:
the Document object

getTemplateName

public String getTemplateName()

Returns the name of the template currently being processed.

Returns:
the template name

getProcessOnlyElementNodes

@Deprecated
public boolean getProcessOnlyElementNodes()
Deprecated. To be removed in 2.1.x. This flag has been substituted by two flags available at the getProcessTextNodes() and getProcessCommentNodes() getter methods.

Returns whether only element nodes should be processed (as opposed to texts, CDATAs, comments, etc.). Default is true.

Returns:
whether only element nodes will be processed

getProcessTextNodes

public boolean getProcessTextNodes()

Returns whether text nodes (which include Text and CDATASection nodes) will be processed.

This flag is false by default as these nodes are not processed by default. This can be changed during processor execution by using methods available at the ProcessorResult class.

Returns:
whether text nodes will be processed.
Since:
2.0.15

getProcessCommentNodes

public boolean getProcessCommentNodes()

Returns whether Comment nodes will be processed.

This flag is false by default as these nodes are not processed by default. This can be changed during processor execution by using methods available at the ProcessorResult class.

Returns:
whether comment nodes will be processed.
Since:
2.0.15

getIdCounts

public Map<String,Integer> getIdCounts()

Returns the map of ID counts.

These numbers are used to avoid conflicts among elements with the same id attribute; for example elements being repeated as a part of a th:each iteration.

Returns:
the current map of ID counts

getExecutionAttributes

public Map<String,Object> getExecutionAttributes()

Returns the execution attributes.

Returns:
the current map of execution attributes

getExecutionAttribute

public Object getExecutionAttribute(String attributeName)

Returns the execution attribute with the specified name.

Parameters:
attributeName - the name of the attribute to be retrieved
Returns:
the value of the attribute

getAndIncrementIDSeq

public Integer getAndIncrementIDSeq(String id)

Returns a new index (ID count) for a specific value of the id attribute, and increments the count.

Parameters:
id - the ID for which the count will be computed
Returns:
the new count, ready to be used

getNextIDSeq

public Integer getNextIDSeq(String id)

Returns the index (ID count) for a specific value of the id attribute without incrementing the count.

Parameters:
id - the ID for which the count will be retrieved
Returns:
the current count

getPreviousIDSeq

public Integer getPreviousIDSeq(String id)

Returns the last index (ID count) returned for a specific value of the id attribute (without incrementing the count).

Parameters:
id - the ID for which the last count will be retrieved
Returns:
the count

addLocalVariables

public Arguments addLocalVariables(Map<String,Object> newVariables)

Creates a new Arguments object by adding some new local variables to the existing map (the rest of the attributes are copied verbatim).

Parameters:
newVariables - the new variables
Returns:
the new Arguments object

setProcessOnlyElementNodes

@Deprecated
public Arguments setProcessOnlyElementNodes(boolean shouldProcessOnlyElementNodes)
Deprecated. Will be removed in 2.1.x. Use the variants for the new flags instead: setProcessTextNodes(boolean), setProcessCommentNodes(boolean) or setProcessTextAndCommentNodes(boolean, boolean).

Creates a new Arguments object by setting a new value for the processOnlyElementNodes flag.

Parameters:
shouldProcessOnlyElementNodes - whether only element nodes should be processed from this moment in template execution
Returns:
the new Arguments object

setProcessTextNodes

public Arguments setProcessTextNodes(boolean shouldProcessTextNodes)

Creates a new Arguments object by setting a new value for the processTextNodes flag.

Parameters:
shouldProcessTextNodes - whether text nodes (Text and CDATA) should be processed from this moment in template execution
Returns:
the new Arguments object
Since:
2.0.15

setProcessCommentNodes

public Arguments setProcessCommentNodes(boolean shouldProcessCommentNodes)

Creates a new Arguments object by setting a new value for the processCommentNodes flag.

Parameters:
shouldProcessCommentNodes - whether comment nodes should be processed from this moment in template execution
Returns:
the new Arguments object
Since:
2.0.15

setProcessTextAndCommentNodes

public Arguments setProcessTextAndCommentNodes(boolean shouldProcessTextNodes,
                                               boolean shouldProcessCommentNodes)

Creates a new Arguments object by setting new values for the processTextNodes and processCommentNodes flags.

Parameters:
shouldProcessTextNodes - whether text nodes (Text and CDATA) should be processed from this moment in template execution
shouldProcessCommentNodes - whether comment nodes should be processed from this moment in template execution
Returns:
the new Arguments object
Since:
2.0.15

addLocalVariablesAndProcessOnlyElementNodes

@Deprecated
public Arguments addLocalVariablesAndProcessOnlyElementNodes(Map<String,Object> newVariables,
                                                                        boolean shouldProcessOnlyElementNodes)
Deprecated. Will be removed in 2.1.x. Use the variants for the new flags instead: setProcessTextNodes(boolean), setProcessCommentNodes(boolean) or setProcessTextAndCommentNodes(boolean, boolean).

Creates a new Arguments object by setting new local variables and a new value for the processOnlyElementNodes flag.

Parameters:
newVariables - the new local variables
shouldProcessOnlyElementNodes - whether only element nodes should be processed from this moment in template execution
Returns:
the new Arguments object

addLocalVariablesAndProcessTextNodes

public Arguments addLocalVariablesAndProcessTextNodes(Map<String,Object> newVariables,
                                                      boolean shouldProcessTextNodes)

Creates a new Arguments object by setting new local variables and a new value for the processTextNodes flag.

Parameters:
newVariables - the new local variables
shouldProcessTextNodes - whether text nodes (Text and CDATA) should be processed from this moment in template execution
Returns:
the new Arguments object
Since:
2.0.15

addLocalVariablesAndProcessCommentNodes

public Arguments addLocalVariablesAndProcessCommentNodes(Map<String,Object> newVariables,
                                                         boolean shouldProcessCommentNodes)

Creates a new Arguments object by setting new local variables and a new value for the processCommentNodes flag.

Parameters:
newVariables - the new local variables
shouldProcessCommentNodes - whether comment nodes should be processed from this moment in template execution
Returns:
the new Arguments object
Since:
2.0.15

addLocalVariablesAndProcessTextAndCommentNodes

public Arguments addLocalVariablesAndProcessTextAndCommentNodes(Map<String,Object> newVariables,
                                                                boolean shouldProcessTextNodes,
                                                                boolean shouldProcessCommentNodes)

Creates a new Arguments object by setting new local variables and new values for the processTextNodes and processCommentNodes flags.

Parameters:
newVariables - the new local variables
shouldProcessTextNodes - whether text nodes (Text and CDATA) should be processed from this moment in template execution
shouldProcessCommentNodes - whether comment nodes should be processed from this moment in template execution
Returns:
the new Arguments object
Since:
2.0.15

setSelectionTarget

public Arguments setSelectionTarget(Object newSelectionTarget)

Creates a new Arguments object by setting a new selection target.

Parameters:
newSelectionTarget - the new selection target
Returns:
the new Arguments object
Since:
2.0.9

addLocalVariablesAndSelectionTarget

public Arguments addLocalVariablesAndSelectionTarget(Map<String,Object> newVariables,
                                                     Object selectionTarget)

Creates a new Arguments object by adding some new local variables and setting a selection target.

Parameters:
newVariables - the new variables
Returns:
the new Arguments object
Since:
2.0.9


Copyright © 2012 The THYMELEAF team. All Rights Reserved.