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:
Configuration
): getConfiguration()
getTemplateName()
IContext
): AbstractProcessingContext.getContext()
getIdCounts()
AbstractProcessingContext.getExpressionEvaluationRoot()
AbstractProcessingContext.getExpressionSelectionEvaluationRoot()
EVAL_SELECTION_TARGET_LOCAL_VARIABLE_NAME
Constructor and Description |
---|
Arguments(TemplateEngine templateEngine,
TemplateProcessingParameters templateProcessingParameters,
TemplateResolution templateResolution,
TemplateRepository templateRepository,
Document document)
Create a new Arguments instance.
|
Modifier and Type | Method and Description |
---|---|
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 |
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).
|
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 |
setSelectionTarget(Object newSelectionTarget)
Creates a new Arguments object by setting a new selection target.
|
computeExpressionObjects, getExpressionEnhancingDialects
getContext, getExpressionEvaluationRoot, getExpressionObjects, getExpressionSelectionEvaluationRoot, getLocalVariable, getLocalVariables, getSelectionTarget, hasLocalVariable, hasLocalVariables, hasSelectionTarget, mergeNewLocalVariables
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.
templateEngine
- the template engine instance being used.templateProcessingParameters
- the template processing parameters.templateResolution
- the template resolution object.templateRepository
- the template repository in use.document
- the parsed document.public TemplateEngine getTemplateEngine()
Returns the Template Engine associated to this Arguments instance.
public TemplateProcessingParameters getTemplateProcessingParameters()
Returns the Template Processing Parameters used for resolving and parsing the template being processed.
public Configuration getConfiguration()
Returns the Template Engine configuration being used for processing templates.
public TemplateResolution getTemplateResolution()
Returns the template resolution object corresponding to the template currently being processed.
public TemplateRepository getTemplateRepository()
Returns the template repository in use.
public Document getDocument()
Returns the parsed Document DOM object.
public String getTemplateName()
Returns the name of the template currently being processed.
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.
public Map<String,Object> getExecutionAttributes()
Returns the execution attributes.
public Object getExecutionAttribute(String attributeName)
Returns the execution attribute with the specified name.
attributeName
- the name of the attribute to be retrievedpublic Integer getAndIncrementIDSeq(String id)
Returns a new index (ID count) for a specific value of the id attribute, and increments the count.
id
- the ID for which the count will be computedpublic Integer getNextIDSeq(String id)
Returns the index (ID count) for a specific value of the id attribute without incrementing the count.
id
- the ID for which the count will be retrievedpublic Integer getPreviousIDSeq(String id)
Returns the last index (ID count) returned for a specific value of the id attribute (without incrementing the count).
id
- the ID for which the last count will be retrievedpublic 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).
newVariables
- the new variablespublic Arguments setSelectionTarget(Object newSelectionTarget)
Creates a new Arguments object by setting a new selection target.
newSelectionTarget
- the new selection targetpublic Arguments addLocalVariablesAndSelectionTarget(Map<String,Object> newVariables, Object selectionTarget)
Creates a new Arguments object by adding some new local variables and setting a selection target.
newVariables
- the new variablesselectionTarget
- the new selection targetCopyright © 2017 The THYMELEAF team. All rights reserved.