org.thymeleaf.processor.attr
Interface IAttrProcessor

All Superinterfaces:
Comparable<IAttrProcessor>
All Known Implementing Classes:
AbstractAttributeModifierAttrProcessor, AbstractAttrProcessor, AbstractChildrenModifierAttrProcessor, AbstractConditionalFixedValueAttrProcessor, AbstractConditionalVisibilityAttrProcessor, AbstractFragmentInclusionAttrProcessor, AbstractIterationAttrProcessor, AbstractLocalVariableDefinitionAttrProcessor, AbstractNoOpAttrProcessor, AbstractRemovalAttrProcessor, AbstractSelectionTargetAttrProcessor, AbstractSingleAttributeModifierAttrProcessor, AbstractStandardAttributeModifierAttrProcessor, AbstractStandardConditionalFixedValueAttrProcessor, AbstractStandardConditionalVisibilityAttrProcessor, AbstractStandardFragmentInclusionAttrProcessor, AbstractStandardIterationAttrProcessor, AbstractStandardLocalVariableDefinitionAttrProcessor, AbstractStandardSelectionTargetAttrProcessor, AbstractStandardSingleAttributeModifierAttrProcessor, AbstractStandardSingleValueMultipleAttributeModifierAttrProcessor, AbstractStandardTextChildModifierAttrProcessor, AbstractStandardTextInlinerAttrProcessor, AbstractStandardUnescapedTextChildModifierAttrProcessor, AbstractTextChildModifierAttrProcessor, AbstractTextInlinerAttrProcessor, AbstractUnescapedTextChildModifierAttrProcessor, StandardAltTitleAttrProcessor, StandardAttrappendAttrProcessor, StandardAttrAttrProcessor, StandardAttrprependAttrProcessor, StandardClassappendAttrProcessor, StandardConditionalFixedValueAttrProcessor, StandardDOMEventAttributeModifierAttrProcessor, StandardEachAttrProcessor, StandardFragmentAttrProcessor, StandardIfAttrProcessor, StandardIncludeAttrProcessor, StandardInlineAttrProcessor, StandardLangXmlLangAttrProcessor, StandardObjectAttrProcessor, StandardRemoveAttrProcessor, StandardSingleNonRemovableAttributeModifierAttrProcessor, StandardSingleRemovableAttributeModifierAttrProcessor, StandardTextAttrProcessor, StandardUnlessAttrProcessor, StandardUtextAttrProcessor, StandardWithAttrProcessor, StandardXmlBaseAttrProcessor, StandardXmlLangAttrProcessor, StandardXmlSpaceAttrProcessor

public interface IAttrProcessor
extends Comparable<IAttrProcessor>

Common interface for all Attribute Processors.

Every attribute processor must declare:

When developing new processors, in order to save code, it is recommended to extend an abstract class like AbstractAttrProcessor (or any of its subclasses) instead of directly implementing this interface.

Since:
1.0
Author:
Daniel Fernández

Method Summary
 Set<AttrApplicability> getAttributeApplicabilities()
           Return the attribute applicabilities.
 Integer getPrecedence()
           Return this processor's precedence.
 Set<Class<? extends IValueProcessor>> getValueProcessorDependencies()
           Return this processor's dependencies.
 AttrProcessResult process(Arguments arguments, TemplateResolution templateResolution, Document document, Element element, Attr attribute)
           Execute this attribute processor.
 
Methods inherited from interface Comparable
compareTo
 

Method Detail

getAttributeApplicabilities

Set<AttrApplicability> getAttributeApplicabilities()

Return the attribute applicabilities.

These applicabilities (a set of AttrApplicability objects) specify the cases in which this attribute processor would be executed. This must at least include an attribute name (execute if attribute name is A) and can also include tag names (execute if attribute name is A and it is set in a tag with name T), companion attributes with values (execute if attribute name is A and it is set in a tag with name T which has an attribute A2 with value V), etc.

Refer to the AttrApplicability API for more details.

Returns:
the attribute applicabilities.

getPrecedence

Integer getPrecedence()

Return this processor's precedence.

When a tag includes several attributes that have an attribute processor associated, the precedences of these processors establish the order in which they will be executed (lowest precedence value is first). This is important because each attribute processor will be able to see the results of the previously executed ones.

Returns:
the processor's precedence (lowest will be executed first).

getValueProcessorDependencies

Set<Class<? extends IValueProcessor>> getValueProcessorDependencies()

Return this processor's dependencies.

The dependencies are the set of value processors (IValueProcessor objects) this attribute processor needs for being executed. This has to be declared for dialect validation purposes at configuration time.

Returns:
the set of value processor dependencies.

process

AttrProcessResult process(Arguments arguments,
                          TemplateResolution templateResolution,
                          Document document,
                          Element element,
                          Attr attribute)

Execute this attribute processor.

This execution logic will receive as parameters the execution argument (an Arguments object), the result of resolving the processed template by the Template Resolver (a TemplateResolution object), the complete DOM node tree of the template being processed (the Document), the tag in which the currently executed attribute was found (the Element) and the attribute itself (Attr).

Parameters:
arguments - the execution arguments, containing Template Engine configuration and execution context.
templateResolution - the result of resolving the template by the Template Resolvers.
document - the DOM node tree (document) of the template being executed.
element - the tag containing the currently executed attribute.
attribute - the attribute being executed.
Returns:
an AttrProcessResult with the result of the execution.


Copyright © 2011 The THYMELEAF team. All Rights Reserved.